xiaochus / YOLOv3

Keras implementation of yolo v3 object detection.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Find mistake in code

amichayfeldman opened this issue · comments

I found mistake in the code.

File: yolo_model.py

for image with width not equal to height, this lines causes to error (lines 59-63):

        col = np.tile(np.arange(0, grid_w), grid_w).reshape(-1, grid_w)
        row = np.tile(np.arange(0, grid_h).reshape(-1, 1), grid_h)

        col = col.reshape(grid_h, grid_w, 1, 1).repeat(3, axis=-2)
        row = row.reshape(grid_h, grid_w, 1, 1).repeat(3, axis=-2)

instead, copy and paste these lines :

col = np.tile(np.arange(0, grid_w), grid_h).reshape(-1, grid_w)
row = np.tile(np.arange(0, grid_h).reshape(-1, 1), grid_w)
col = col.reshape(grid_h, grid_w, 1, 1).repeat(3, axis=-2)
row = row.reshape(grid_h, grid_w, 1, 1).repeat(3, axis=-2)