YAD2K
YAD2K copied to clipboard
[Logic Error] Function to find the `preprocess_true_boxes()` ?
https://github.com/allanzelener/YAD2K/blob/a42c760ef868bc115e596b56863dc25624d2e756/yad2k/models/keras_yolo.py#L420
box = box[0:4] * np.array([conv_width, conv_height, conv_width, conv_height])
i = np.floor(box[1]).astype('int')
j = np.floor(box[0]).astype('int')
i, j may be rather than 1, and the index must be out of index !
conv_height=conv_width=13 and box[0:4] means relative x, y, w, h, in the range [0, 1] indicating a percentage of the original image dimensions. [0,1]*13=[0,13] i,j is integer in the range [0, 12] will not out of index
@nash100 , if you do something with the pascal voc dataset, you will find this problem. And I think, the Anchor box may be larger than 1.0.
i did not retrain it with the pascal voc dataset,but it works well with data @shadySource give (https://github.com/shadySource/DATA). maybe you can compare your code with this
I have meet the same question.when i run this model for pascal,it told me the index is out of the range.i found the reason is at this code in retrain_yolo.py
def process_data(images, boxes=None): '''processes the data''' images = [PIL.Image.fromarray(i) for i in images] orig_size = np.array([images[0].width, images[0].height]) orig_size = np.expand_dims(orig_size, axis=0)
the orig_size is only looking at the first images,this process should have a precondition that all images's size are same. but for pascal,our images size is not all same.so ,when we preprocess the box into (x_center,y_center,box_width,box_height), the boxes are not in range(0,1),we should divide by the real orig_size for every image.