Focal Loss for Dense Rotation Object Detection

Overview

Convert ResNets weights from GluonCV to Tensorflow

Abstract

GluonCV released some new resnet pre-training weights and designed some new resnets (such as resnet_v1_b, resnet_v1_d, refer this for detail).

This project reproduces the resnet in glouncv by Tensorflow and attempts to convert the pre-training weights in glouncv to the Tensorflow CheckPoints. At present, we have completed the conversion of resnet50_v1_b, resnet101_v1_b, resnet50_v1_d, resnet101_v1_d, and the 1000-dimensional Logits error rate is controlled within the range of 1e-5. (We welcome you to submit PR to support more models.)

We also try to transfer these weights to object detection (using FPN as the baseline, the specific detection code we will post here.), and train on voc07trainVal (excluding voc2012 dataset), test in voc07test. The results are as follows:

Comparison

use_voc2007_metric

Models mAP sheep horse bicycle bottle cow sofa bus dog cat person train diningtable aeroplane car pottedplant tvmonitor chair bird boat motorbike
Faster-RCNN resnet101_v1(original) 74.63 76.35 86.18 79.87 58.73 83.4 74.75 80.03 85.4 86.55 78.24 76.07 70.89 78.52 86.26 47.80 76.34 52.14 78.06 58.90 78.04
FPN resnet101_v1(original) 76.14 74.63 85.13 81.67 63.79 82.43 77.83 83.07 86.45 85.82 81.08 81.01 71.22 80.01 86.30 48.05 73.89 56.99 78.33 62.91 82.24
FPN resnet101_v1_d 77.98 78.01 87.48 85.34 65.42 84.56 74.42 82.97 87.87 87.34 82.14 84.44 70.32 80.64 88.6 51.9 76.59 59.31 81.19 67.84 83.1

FPN_resnet101_v1_d is transfer from GluonCV

FPN_resnet101_v1(original) is official resnet in tensorflow/models

My Development Environment

1、python2.7 (anaconda recommend)

2、cuda9.0

3、opencv(cv2)

4、mxnet-cu90 (1.3.0)

5、tensorflow == 1.10

6、GlounCV

Download MxNet GluonCV PreTrained Weights

cd $PATH_ROOT/resnet
(modify the resnet version in the main function of download_mxnet_resnet_weights.py.)
python download_mxnet_resnet_weights.py

Convert MxNet Weights To Tensorflow CheckPoint and caculate Erros

modify the main function in gluon2TF/resnet/test_resnet.py as following, and then run it

MODEL_NAME = 'resnet101_v1d' (modify the version as u want)
Mxnet_Weights_PATH = '../mxnet_weights/resnet101_v1d-1b2b825f.params' (remember modify the path)

cal_erro(img_path='../demo_img/person.jpg',
             use_tf_ckpt=False,
             ckpt_path='../tf_ckpts/%s.ckpt' % MODEL_NAME,
             save_ckpt=True)

Just run it :

cd $PATH_ROOT/resnet
python test_resnet

caculate Erros between the converted tensorflow chenckpoints and Mxnet GluonCV Weights

modify the main function in gluon2TF/resnet/test_resnet.py as following, and then run it

MODEL_NAME = 'resnet101_v1d' (modify the version as u want)
Mxnet_Weights_PATH = '../mxnet_weights/resnet101_v1d-1b2b825f.params' (remember modify the path)

cal_erro(img_path='../demo_img/person.jpg',
             use_tf_ckpt=True,
             ckpt_path='../tf_ckpts/%s.ckpt' % MODEL_NAME,
             save_ckpt=False)

Just run it :

cd $PATH_ROOT/resnet
python test_resnet
You might also like...
Seach Losses of our paper 'Loss Function Discovery for Object Detection via Convergence-Simulation Driven Search', accepted by ICLR 2021.
Seach Losses of our paper 'Loss Function Discovery for Object Detection via Convergence-Simulation Driven Search', accepted by ICLR 2021.

CSE-Autoloss Designing proper loss functions for vision tasks has been a long-standing research direction to advance the capability of existing models

Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

Code for the TIP 2021 Paper
Code for the TIP 2021 Paper "Salient Object Detection with Purificatory Mechanism and Structural Similarity Loss"

PurNet Project for the TIP 2021 Paper "Salient Object Detection with Purificatory Mechanism and Structural Similarity Loss" Abstract Image-based salie

Official implementation for CVPR 2021 paper: Adaptive Class Suppression Loss for Long-Tail Object Detection
Official implementation for CVPR 2021 paper: Adaptive Class Suppression Loss for Long-Tail Object Detection

Adaptive Class Suppression Loss for Long-Tail Object Detection This repo is the official implementation for CVPR 2021 paper: Adaptive Class Suppressio

Complete-IoU (CIoU) Loss and Cluster-NMS for Object Detection and Instance Segmentation (YOLACT)
Complete-IoU (CIoU) Loss and Cluster-NMS for Object Detection and Instance Segmentation (YOLACT)

Complete-IoU Loss and Cluster-NMS for Improving Object Detection and Instance Segmentation. Our paper is accepted by IEEE Transactions on Cybernetics

Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

MOT-Tracking-by-Detection-Pipeline - For Tracking-by-Detection format MOT (Multi Object Tracking), is it a framework that separates Detection and Tracking processes? A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.

imutils A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, and displ

Owner
null
Focal Sparse Convolutional Networks for 3D Object Detection (CVPR 2022, Oral)

Focal Sparse Convolutional Networks for 3D Object Detection (CVPR 2022, Oral) This is the official implementation of Focals Conv (CVPR 2022), a new sp

DV Lab 280 Jan 7, 2023
Extreme Rotation Estimation using Dense Correlation Volumes

Extreme Rotation Estimation using Dense Correlation Volumes This repository contains a PyTorch implementation of the paper: Extreme Rotation Estimatio

Ruojin Cai 29 Nov 18, 2022
Official code of the paper "ReDet: A Rotation-equivariant Detector for Aerial Object Detection" (CVPR 2021)

ReDet: A Rotation-equivariant Detector for Aerial Object Detection ReDet: A Rotation-equivariant Detector for Aerial Object Detection (CVPR2021), Jiam

csuhan 334 Dec 23, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
Official code for "Focal Self-attention for Local-Global Interactions in Vision Transformers"

Focal Transformer This is the official implementation of our Focal Transformer -- "Focal Self-attention for Local-Global Interactions in Vision Transf

Microsoft 486 Dec 20, 2022
Focal and Global Knowledge Distillation for Detectors

FGD Paper: Focal and Global Knowledge Distillation for Detectors Install MMDetection and MS COCO2017 Our codes are based on MMDetection. Please follow

Mesopotamia 261 Dec 23, 2022
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

null 32 Sep 21, 2022
An implementation for the loss function proposed in Decoupled Contrastive Loss paper.

Decoupled-Contrastive-Learning This repository is an implementation for the loss function proposed in Decoupled Contrastive Loss paper. Requirements P

Ramin Nakhli 71 Dec 4, 2022
Implement of "Training deep neural networks via direct loss minimization" in PyTorch for 0-1 loss

This is the implementation of "Training deep neural networks via direct loss minimization" published at ICML 2016 in PyTorch. The implementation targe

Cuong Nguyen 1 Jan 18, 2022
CVPR2022 paper "Dense Learning based Semi-Supervised Object Detection"

[CVPR2022] DSL: Dense Learning based Semi-Supervised Object Detection DSL is the first work on Anchor-Free detector for Semi-Supervised Object Detecti

Bhchen 69 Dec 8, 2022