Open arnaudbenard opened 7 years ago
Thanks a lot for your contribution. However, if I understand correctly your code, there is one case that is not covered. In my Dataset class, there are two options whether to load everything to memory or just load it when you need it and then it provides a path instead of a numpy array. In the first case, your code would work. In the second case that is implemented using this:
if type(image) is not np.ndarray: image = np.array(Image.open(image), dtype=np.uint8)
in my original code it will not.
If you could incorporate this possibility in your pull request, it would be great!
We'll do another pass over it. Anyway, the preprocessing is done inefficiently.
@scaelles Thank you for the feedback, I will take the image loading use-case into account. I think @gyglim is right and we should move the preprocessing to the network to avoid creating a new graph for each execution. We will push an update!
Are there other functions you would like to move to TF?
@gyglim I agree that the preprocessing is inefficient and should be move to a more TF friendly manner, but I haven't had the time to do that.
@arnaudbenard I think that the other function that can easily be moved to TF is preprocess_labels
(I implemented it, but I didn't fully test it).
I think also that the new TF dataset api could help to have a more clean solution
I have moved
preprocess_img
topreprocess_img_tf
which does the preprocessing in TF. If you are happy with that we can remove the oldpreprocess_img
method.Let me know what you think!
cc @gyglim