talmo/leap

Errors with non-square videos

Closed this issue · 5 comments

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

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 8e83aaf), but feel free to re-open the issue if you're still experiencing problems.

Cheers!

Talmo

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

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

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!