allanzelener / YAD2K

YAD2K: Yet Another Darknet 2 Keras
Other
2.71k stars 879 forks source link

retrain_yolo image size/shape (416,416 vs 416,416,3) #175

Open goodwillyoga opened 4 years ago

goodwillyoga commented 4 years ago

I'm getting the error when using the combination of package_dataset.py https://github.com/alecGraves/DATA/blob/master/package_dataset.py by alec to create npz file for images and bounding boxes and running retrain_yolo.py

The error is happening with retrain_yolo.py: File "retrain_yolo.py", line 157, in process_data return np.array(processed_images), np.array(boxes) ValueError: could not broadcast input array from shape (416,416,3) into shape (416,416)

But it could be the way npz file is being created. What I am failing to understand is how training images which are of shape like (750, 1000, 3), (1080, 1920, 3), (320, 480, 3) etc...can be resized by retrain_yolo.py...

images = [PIL.Image.fromarray(i) for i in images] processed_images = [i.resize((416, 416), PIL.Image.BICUBIC) for i in images]

Of course, here is when I'm getting the error: ValueError: could not broadcast input array from shape (416,416,3) into shape (416,416)

The original images have a shape of three. Can someone please help understand what's happening here. Thanks