Open bairdzhang opened 9 years ago
@bairdzhang Thanks for reporting.
I think the root of the problem is that cv2.imread
returns a 2D numpy array instead of 3D array. On my system it seems always to return a 3D array even for grayscale images. I pushed a fix for this to the dev branch (dcefb9a75); can you try it on your system?
@yosinski The len(im.shape)
is 3 for me before or after im = im[:,:,::-1]
.
And when I print im[1,1,:]
before and after im = im[:,:,::-1]
, the channels do inverse. Before im = im[:,:,::-1]
, I can use imshow
to show the image, however, after im = im[:,:,::-1]
, imshow
cannot show the image and give this error message:
Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat.
I'm using OpenCV 2.3.1, and It's really odd to happen that error.
@bairdzhang hi,did you solve the problem?
I get this:ValueError: could not broadcast input array from shape (300,300) into shape (300,300,3)
Even though i changed the code as https://github.com/yosinski/deep-visualization-toolbox/commit/dcefb9a759b74cdf6cd30314d021cd5af099f5f4
If you solve the problem,can you please tell me ?
@yosinski Thanks for your great work!
I want to run the original data as you provided,but when ./run_toolbox.py
,i get the same error even i changed the code as you fixed.Can you help me with this issue?Thank you very much!
@bairdzhang, @georgiazhang I've added support for grayscale based networks, and also for color based networks loading a grayscale image
Latest version is in https://github.com/arikpoz/deep-visualization-toolbox
Hi,
After deploying this project successfully, I tried to run ./run_toolbox.py, but I got the following error and traceback:
Then I read some of the source code, I found the
im = im[:,:,::-1]
may not work well on my system. I changed theim = im[:,:,::-1]
toim = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
in cv2_read_file_rgb and changedcv2.imshow(window_name, img[:,:,::-1])
toimg = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
andcv2.imshow(window_name, img)
in cv2_imshow_rgb, then everything goes well (Only static image files are used).I don't know whether it is a general issue or it happens because my system configuration is odd or incorrect. Any ideas?
Thanks, Baird