oeway / pytorch-deform-conv

PyTorch implementation of Deformable Convolution
MIT License
910 stars 151 forks source link

Gif image visualization #12

Open bkvie opened 6 years ago

bkvie commented 6 years ago

Hi,

is there visualization for the method, as seen in the provided gif file? How would one ideally implement this feature?

oeway commented 6 years ago

Hi, the gif was made by @felixlaumon (from https://github.com/felixlaumon/deform-conv), for more details, please consult him.

With libraries such as imageio, one can easily generates gif image from a list of numpy images:

import imageio
images = [] 
# generate your images here, using matplotlib etc., then convert to  numpy arrays
...
imageio.mimsave('/path/to/movie.gif', images)

Refer to here: https://stackoverflow.com/questions/753190/programmatically-generate-video-or-animated-gif-in-python?answertab=votes#tab-top and also here: http://www.icare.univ-lille1.fr/wiki/index.php/How_to_convert_a_matplotlib_figure_to_a_numpy_array_or_a_PIL_image

bkvie commented 6 years ago

Making the gif is easy, I was wondering about visualizing the networks field of view, ie the point cloud simulating the convolutions

oeway commented 6 years ago

You can read this : https://medium.com/@phelixlau/notes-on-deformable-convolutional-networks-baaabbc11cf3 the read dots are sampling location, you can just plot the offset generated here: https://github.com/oeway/pytorch-deform-conv/blob/master/torch_deform_conv/layers.py#L39 plot it and make a gif when deforming the input image.

It would be a nice PR to have if you succeed.

kirkzZ commented 3 years ago

hello,can you help me , I can't visualizing the receptive field

oeway commented 3 years ago

@kirkzZ Sorry that I haven't worked on this repo for a while, and some users mentioned there is some issue with the implementation here. So maybe you can try others' implementation instead?

kirkzZ commented 3 years ago

I want to visualizing the receptive field as points(or visualizing the sample points), could you give me some ideas