You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run training and some time after the first epoch begins, I am running into an issue where the following call (in transformer.py) fails:
masks = cv2.warpAffine(masks, M, cv_shape, flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_CONSTANT, borderValue=0)
Specifically, there is an OpenCV assertion error, stating that "error: (-215) _src.channels() <= 4 || (interpolation != INTER_LANCZOS4 && interpolation != INTER_CUBIC) in function cv::warpAffine". Could you please point me at what might be wrong here?
Thanks a lot!
N.B. Looking at the code, at first glace it would so seem that several Mats are passed into warpAffine(), is this intentional?
The text was updated successfully, but these errors were encountered:
PavelPr
changed the title
Crash on cv2.WarpImage()
Crash on cv2.warpAffine()
Jun 3, 2018
PavelPr
changed the title
Crash on cv2.warpAffine()
Crash on a call to cv2.warpAffine()
Jun 3, 2018
I trained using opencv v2.4.9, which allows cubic interpolation for affine warping on an image with any number of channels. Apparently, later versions of opencv (including the current master branch) do not allow this. So, you can either step back to opencv 2.4.9 (which in my experience provides faster image resizing and is worthwhile); or remove this line from transformer.py:
masks = cv2.warpAffine(masks, M, cv_shape, flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_CONSTANT, borderValue=0)
and replace it with something like this:
out_masks = np.zeros(cv_shape[::-1]+(masks.shape[-1],))
for i in range(masks.shape[-1]):
out_masks[:,:,i] = cv2.warpAffine(masks[:,:,i], M, cv_shape, flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_CONSTANT, borderValue=0)
masks = out_masks
That way, you're looping through the mask channels instead of warping them all at once.
Also, please pull the latest master branch to incorporate a new fix I just pushed to the data generation code.
Hi!
First, thank you for your hard work!
I am trying to run training and some time after the first epoch begins, I am running into an issue where the following call (in transformer.py) fails:
masks = cv2.warpAffine(masks, M, cv_shape, flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_CONSTANT, borderValue=0)
Specifically, there is an OpenCV assertion error, stating that "error: (-215) _src.channels() <= 4 || (interpolation != INTER_LANCZOS4 && interpolation != INTER_CUBIC) in function cv::warpAffine". Could you please point me at what might be wrong here?
Thanks a lot!
N.B. Looking at the code, at first glace it would so seem that several Mats are passed into warpAffine(), is this intentional?
The text was updated successfully, but these errors were encountered: