Project Description:

One of the central problems in computer vision is to recoginze and localize object instance with an input image. In this project, we will implement FCOS - a fully convolutional one stage object detector, using Pytorch. We will follow its journal version, which incorporates better designs and provides more detail. Further, we will train FCOS on PASCAL VOC 2007

What excited me from this project:

This is the implementation of the FCOS model. The model consists of (1) ResNet-18 backbone to extract image fetures (2) a feature pyramid network to refine image features into a pyramid (3) shared classification and regression head that are applied to each pyramid level and predicts object labels and boxes. All implemented in the FCOS class.

FCOS implementation brief details:

  1. FCOSClassificationHead FCOSRegressionHead will iterate over feature maps and create the prediction results, inculding class labels, regression offsets, and centerness.
  2. compute_loss computes the desired targets of model outputs, and calculated the loss used during training. To elaborate more, this function helps us get the ground-truth labels and ground-truth regression targets for each point. The most important part is to find out the label for each point, 0 for background and 1 ~ 20 for foreground categories. Target for each point need to follow 2 conditions. First, the function checks whether a point is in the center region of bounding box. Second, the function checks the regression constraints. After getting all the target, we follow the formulas in paper to calculate 3 losses.
  3. inference This function post-processes the outputs of the FCOS model, and decode object detection reuslts (bounding boxes, scores, and labels)

Image Results:

截圖 2022-12-24 下午4.10.52.png

截圖 2022-12-24 下午4.11.04.png

Please visit here to view the code of the project and here to read the details of this project.

Reference: 1.  Z. Tian, C. Shen, H. Chen, and T. He. Fcos: A simple and strong anchor- free object detector. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.