Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

How to get flow_from_directory accept absolute path of images as input #56

Closed
lixiangchun opened this issue Sep 13, 2018 · 3 comments
Closed

Comments

@lixiangchun
Copy link

I learned from the manual page of flow_from_directory, the first argument passed to flow_from_directory is a directory. Sometimes, it's also convenient to pass the path of images if the images are placed in multiple directories. If we could get flow_from_directory to accept images in the following format:

/path1/img1.jpg cat
/path2/img2.jpg dog

The first column is the absolute path to the image, and the second column is the class names.

@Dref360
Copy link
Contributor

Dref360 commented Sep 25, 2018

Have you looked into flow_from_dataframe?

@qinst64
Copy link

qinst64 commented Oct 23, 2018

#67
Tried but flow_from_dataframe was not working: x_col needs to be filename only?

Dref360 pushed a commit that referenced this issue Jan 6, 2019
### Summary
The documentation in `flow_from_dataframe` and `DataframeIterator` states that if `directory` is None then the filenames are taken as absolute paths. I agree with this behavior, and I think this should be the default behavior if no directory parameter is given. This PR sets the default directory parameter as None and adds the corresponding tests. With this PR is enough to have the absolute paths in a Dataframe and just send that dataframe as parameter to `flow_from_dataframe`

Closses #67 #56 #116 

### PR Overview

- [y] This PR requires new unit tests [y/n] (make sure tests are included)
- [n] This PR requires to update the documentation [y/n] (make sure the docs are up-to-date)
- [y] This PR is backwards compatible [y/n]
- [n] This PR changes the current API [y/n] (all API changes need to be approved by fchollet)
@rragundez
Copy link
Collaborator

This issue has been resolved in the current version, as x_col accepts absolute paths. It can be closed. @Dref360

@Dref360 Dref360 closed this as completed Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants