SynthText_Chinese_version icon indicating copy to clipboard operation
SynthText_Chinese_version copied to clipboard

operands could not be broadcast together with shapes

Open Bourne-M opened this issue 3 years ago • 9 comments

请问 这个问题有人遇见过吗 operands could not be broadcast together with shapes (1,600) (1,2).

Bourne-M avatar Oct 11 '21 13:10 Bourne-M

what exactly did you run?

jasonyux avatar Oct 12 '21 02:10 jasonyux

感谢回复,我的环境是这样的: certifi 2016.9.26 cycler 0.10.0
h5py 2.7.1
matplotlib 2.1.1
numpy 1.11.1
opencv-python 3.1.0.0
Pillow 5.0.0
pip 20.0.2
pygame 1.9.3
pyparsing 2.2.0
python-dateutil 2.6.1
pytz 2017.3
scipy 1.0.0
setuptools 36.4.0
six 1.11.0
subprocess32 3.5.4
wget 3.2
wheel 0.37.0

然后直接运行的:python gen.py --viz

Bourne-M avatar Oct 12 '21 02:10 Bourne-M

I think the issue is with the shape. Upon checking the code center and ij comes from:

contour,hier = cv2.findContours(mask.copy().astype('uint8'),
                                    mode=cv2.RETR_CCOMP, 
                                    method=cv2.CHAIN_APPROX_SIMPLE)
contour = [np.squeeze(c).astype('float') for c in contour]
# blablabla
center = np.array([W,H])/2
n_front = np.array([0.0,0.0,-1.0])
for i in xrange(len(contour)):
     cnt_ij = contour[i]
     xyz = su.DepthCamera.plane2xyz(center, cnt_ij, plane)

Output to those steps should be checked.

Just a brief glimpse, you are using opencv-python 3.1.0.0, but I think it needed opencv2.*. Perhaps thats where it got wrong.

Maybe try using the opencv3 branch of my forked repo. Does the same issue come up?

jasonyux avatar Oct 12 '21 03:10 jasonyux

I think the issue is with the shape. Upon checking the code center and ij comes from:

contour,hier = cv2.findContours(mask.copy().astype('uint8'),
                                    mode=cv2.RETR_CCOMP, 
                                    method=cv2.CHAIN_APPROX_SIMPLE)
contour = [np.squeeze(c).astype('float') for c in contour]
# blablabla
center = np.array([W,H])/2
n_front = np.array([0.0,0.0,-1.0])
for i in xrange(len(contour)):
     cnt_ij = contour[i]
     xyz = su.DepthCamera.plane2xyz(center, cnt_ij, plane)

Output to those steps should be checked.

Just a brief glimpse, you are using opencv-python 3.1.0.0, but I think it needed opencv2.*. Perhaps thats where it got wrong.

Maybe try using the opencv3 branch of my forked repo. Does the same issue come up?

yes ,i am using opencv3 branch

Bourne-M avatar Oct 12 '21 03:10 Bourne-M

may i asking how should i get pictures generated out?

Bourne-M avatar Oct 12 '21 03:10 Bourne-M

i have got the problem,just modify contour,hier = ... to _,contour,hier = , then it will work. but i wondering why its always timeout while generating pictures

Bourne-M avatar Oct 12 '21 03:10 Bourne-M

Good catch. Somehow I did not specify which opencv3 version to use. I got it working previously but obviously that was also version dependent.

Upon testing I also got a signal error. I think it was a Windows thing.

Is there any specific reason why singal.SIGALRM is not working on windows? Yes, Windows OS doesn't implement that signal.

https://stackoverflow.com/questions/52779920/why-is-signal-sigalrm-not-working-in-python-on-windows

jasonyux avatar Oct 12 '21 04:10 jasonyux

I think at some point I switched to using CentOS 7 because some of the preprocessing also has a Linux dependency. If we want a more detailed steps on how to do preprocessing for some of your images for this repo, checkout the learning branch.

jasonyux avatar Oct 12 '21 04:10 jasonyux

I think at some point I switched to using CentOS 7 because some of the preprocessing also has a Linux dependency. If we want a more detailed steps on how to do preprocessing for some of your images for this repo, checkout the learning branch.

your repo helps a lot, thanks for your work

Bourne-M avatar Oct 12 '21 05:10 Bourne-M