I am trying to build a custom Object Detection model which can detect guns from a given image. The dataset is from here.

The dataset has a good number of images and each image has 4 coordinates of bounding boxes with it. I recently read about YOLO and the structure of its labels is as follows:

YOLO labels

I need to get this label for every grid cell of the input image. The dataset which I have contains coordinates for the object and not a grid cell in the image.

Also, I can manage to get bx, by, bh, bw and c1 , c2 , c3, but how do I extract pc for training from the dataset?

I will like to build a YOLO model from scratch but I don't know how to transform the dataset so that I can train a YOLO on it.


1 Answer 1


So, I found the answer myself. Basically, if the grid cell contains the centre of the bounding box then the grid cell will have a $p_c$ of 1 otherwise 0 if there is no object.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.