Closed jogundas closed 7 years ago
Interestingly, the same error pops up when using the recommended versions of keras, tf, and cv2.
Apparently there was an issue with the format of my image: closing the issue.
In particular, my images were grayscale. I've solved the issue by adding the following hack in the generate
function of the Generator
class right after the line img = imread(img_path).astype('float32')
in the training notebook.
try:
# The input image is not grayscale but has a weird number of channels
if img.shape[2] != 3:
print "Problem with input image "+key+" shape - investigate!"
except:
# The input image has only 1 channel (grayscale), copy it over to 3 channels
img.resize((img.shape[0], img.shape[1], 1))
img = np.repeat(img, 3, 2)
I am trying to train on Keras 2. However, something goes wrong with the generator.
Detection works after implementing minor changes, as per here.
However, there is some problem with generation for training when executing
SSD_training.ipynb
. To just try if it works, I am using the provided annotation filegt_pascal.pkl
and copying some image over:When running
I get a shape mismatch error,
Any ideas?