GoogleCloudPlatform / tensorflow-without-a-phd

A crash course in six episodes for software developers who want to become machine learning practitioners.
Apache License 2.0
2.78k stars 907 forks source link

periph_rois #21

Closed abajaj945 closed 5 years ago

abajaj945 commented 6 years ago

Can you please explain the code for periph_rois ,I mean what it is for? and I am not able to understand the significance of 'expand' variable in traineryolo/box_utils.py

martin-gorner commented 6 years ago

Yes, this is an experimental feature. The idea is that assigning a ROI (region of interest) to a YOLO grid cell by its center might be problematic. If the ground truth ROI is off by just a pixel, it might be assigned to a different YOLO grid cell while nothing in the image really justifies it. More worryingly, both YOLO cells will probably find a plane, in roughly the correct position, but one of them will be punished for it in the loss because the ground truth ROI was assigned to one of the cells only.

The "expand" parameter allows a YOLO grid cell be assigned a ground truth ROI even if the ROI is centered slightly outside of the cell (by the factor specified in the "expand" param, typically 1.3). This way, if a plane is centered on a boundary, its ground truth ROI will be assigned to both YOLO grid cells and if both YOLO grid cells (correctly) find the plane, both will be rewarded for it in the loss.

abajaj945 commented 6 years ago

Thank you, I am building a ship detection model and your work is really helpfull.

martin-gorner commented 6 years ago

Have you tried the object detection model and API that is provicded in the Tensorflow distribution ? https://github.com/tensorflow/models/tree/master/research/object_detection

abajaj945 commented 6 years ago

you have taken width of ground truth roi with respect to cell width or image width?

martin-gorner commented 6 years ago

the "expand" parameter which is 1.3 by default is relative to the YOLO cell width.