talmo / leap

LEAP is now deprecated -- check out its successor SLEAP!
https://sleap.ai
Apache License 2.0
206 stars 48 forks source link

Errors with non-square videos #2

Closed richard-warren closed 6 years ago

richard-warren commented 6 years ago

Thanks for the great toolbox! Has this been tested with non-square images? I'm getting error messages at various points in the pipeline when using 404x396 sized videos (both dimensions divisible by 4). For example, when training I get the following:

Created folder: C:\Users\rick\Desktop\github\leap\models\fast_train\180606_104331-n=11 Epoch 1/15 Traceback (most recent call last): File "C:\Users\rick\Anaconda3\lib\site-packages\keras\utils\data_utils.py", line 564, in get inputs = self.queue.get(block=True).get() File "C:\Users\rick\Anaconda3\lib\multiprocessing\pool.py", line 644, in get raise self._value File "C:\Users\rick\Anaconda3\lib\multiprocessing\pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "C:\Users\rick\Anaconda3\lib\site-packages\keras\utils\data_utils.py", line 390, in get_index return _SHARED_SEQUENCES[uid][i] File "C:\Users\rick\Desktop\github\leap\leap\image_augmentation.py", line 71, in getitem X[i], Y[i] = transform_imgs((X[i],Y[i]), theta=self.theta, scale=self.scale) File "C:\Users\rick\Desktop\github\leap\leap\image_augmentation.py", line 38, in transform_imgs X[i][...,c] = cv2.warpAffine(X[i][...,c], T, img_size) ValueError: could not broadcast input array from shape (396,404) into shape (404,396)

Please advise, and thanks again for your work on this.

talmo commented 6 years ago

Hi Rick,

Good catch on that bug! I had a parameter for OpenCV's warpAffine function in reverse order. It should be fixed now (as of commit 8e83aaf5eed1c56ded3b09fde5227759cc44d1e0), but feel free to re-open the issue if you're still experiencing problems.

Cheers!

Talmo

richard-warren commented 6 years ago

Thanks for the quick turn-around! I appreciate your help.

richard-warren commented 6 years ago

I am still getting this error unfortunately. I think line 18 of pts2confmaps should be changed from:

[XX,YY] = meshgrid(1:sz(1),1:sz(2));

to:

[XX,YY] = meshgrid(1:sz(2),1:sz(1));

This appeared to fix it for me.

talmo commented 6 years ago

Thanks again Rick! I always get my meshgrid/ndgrid syntax mixed up. I won't get a chance to test out the whole pipeline with a rectangle dataset for a few days but don't hesitate to open the issue up again if you run into other non-square dimensions problems!

richard-warren commented 6 years ago

Sure thing! I'm running now on rectangle data and getting no overt bugs. Thanks for quick turn-around.

On Fri, Jun 8, 2018 at 3:35 PM, Talmo Pereira notifications@github.com wrote:

Thanks again Rick! I always get my meshgrid https://www.mathworks.com/help/matlab/ref/meshgrid.html/ndgrid https://www.mathworks.com/help/matlab/ref/ndgrid.html syntax mixed up. I won't get a chance to test out the whole pipeline with a rectangle dataset for a few days but don't hesitate to open the issue up again if you run into other non-square dimensions problems!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/talmo/leap/issues/2#issuecomment-395866678, or mute the thread https://github.com/notifications/unsubscribe-auth/AdxmwRq9vSMzzYTHnSg6Q_nWzA0s1DFvks5t6tIRgaJpZM4Ucz-W .