OSVOS-TensorFlow icon indicating copy to clipboard operation
OSVOS-TensorFlow copied to clipboard

preprocess_img in tf

Open arnaudbenard opened this issue 7 years ago • 5 comments

I have moved preprocess_img to preprocess_img_tf which does the preprocessing in TF. If you are happy with that we can remove the old preprocess_img method.

Let me know what you think!

cc @gyglim

arnaudbenard avatar Aug 22 '17 11:08 arnaudbenard

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!

scaelles avatar Aug 23 '17 11:08 scaelles

We'll do another pass over it. Anyway, the preprocessing is done inefficiently.

gyglim avatar Aug 23 '17 12:08 gyglim

@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?

arnaudbenard avatar Aug 23 '17 12:08 arnaudbenard

@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).

scaelles avatar Aug 24 '17 08:08 scaelles

I think also that the new TF dataset api could help to have a more clean solution

bhack avatar Oct 28 '17 08:10 bhack