scaelles / OSVOS-TensorFlow

One-Shot Video Object Segmentation
http://vision.ee.ethz.ch/~cvlsegmentation/osvos/
GNU General Public License v3.0
438 stars 132 forks source link

preprocess_img in tf #7

Open arnaudbenard opened 7 years ago

arnaudbenard commented 7 years ago

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

scaelles commented 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!

gyglim commented 7 years ago

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

arnaudbenard commented 7 years ago

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

scaelles commented 7 years ago

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

bhack commented 7 years ago

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