xiaochus / YOLOv3

Keras implementation of yolo v3 object detection.
MIT License
605 stars 264 forks source link

Find mistake in code #23

Open amichayfeldman opened 5 years ago

amichayfeldman commented 5 years ago

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)