Code Monkey home page Code Monkey logo

piou's Introduction

PIoU Loss

Orientated Object Detection; IoU Loss

PIoU Loss: Towards Accurate Oriented Object Detection in Complex Environments,
Zhiming Chen, Kean Chen, Weiyao Lin, John See, Hui Yu, Yan Ke, Cong Yang

arXiv technical report (arXiv:2007.09584)

Abstract

Object detection using an oriented bounding box (OBB) can better target rotated objects by reducing the overlap with background areas. Existing OBB approaches are mostly built on horizontal bounding box detectors by introducing an additional angle dimension optimized by a distance loss. However, as the distance loss only minimizes the angle error of the OBB and that it loosely correlates to the IoU, it is insensitive to objects with high aspect ratios. Therefore, a novel loss, Pixels-IoU (PIoU) Loss, is formulated to exploit both the angle and IoU for accurate OBB regression. The PIoU loss is derived from IoU metric with a pixel-wise form, which is simple and suitable for both horizontal and oriented bounding box. To demonstrate its effectiveness, we evaluate the PIoU loss on both anchor-based and anchor-free frameworks. The experimental results show that PIoU loss can dramatically improve the performance of OBB detectors, particularly on objects with high aspect ratios and complex backgrounds. Besides, previous evaluation datasets did not include scenarios where the objects have high aspect ratios, hence a new dataset, Retail50K, is introduced to encourage the community to adapt OBB detectors for more complex environments.

Installation

The code was tested on Ubuntu 16.04, with Anaconda Python 3.6 and PyTorch v0.4.1. NVIDIA GPUs are needed for both training and testing. After install Anaconda:

  1. Install pytorch1.3.1:

    conda install pytorch=1.3.1 torchvision -c pytorch
    
  2. Install COCOAPI:

    # COCOAPI=/path/to/clone/cocoapi
    git clone https://github.com/cocodataset/cocoapi.git $COCOAPI
    cd $COCOAPI/PythonAPI
    make
    python setup.py install --user
    
  3. Install the requirements

    pip install -r requirements.txt
    
  4. Compile

    cd $CenterNet_ROOT/src/lib/models/networks/DCNv2
    ./make.sh
    
    cd $CenterNet_ROOT/src/lib/external
    make
    

    cd $CenterNet_ROOT/src/lib/piou_loss python setup.py install

Training and Testing

  1. Data pre-processing

    • retail50k2coco.py
  2. Data-related parameters

    • retail50k.py
  3. Training

    • ctrdet_retail50k_512.sh
  4. Testing

    • retail50k_demo.py
    • retail50k_eval.py

Results

License

PIoU is released under the MIT License (refer to the LICENSE file for details). Portions of the code are borrowed from CenterNet. Please refer to the original License of this project.

Citation

If you find this project useful for your research, please use the following BibTeX entry.

@inproceedings{Yang2020PLT,
  title      = {PIoU Loss: Towards Accurate Oriented Object Detection in Complex Environments},
  author     = {Chen, Zhiming and Chen, Kean and Lin, Weiyao and See, John See and Yu, Hui and Ke, Yan and Yang, Cong},
  booktitle  = {European Conference on Computer Vision},
  pages      = {1-17},
  year       = {2020}
}

Retail50K Dataset

If you want to reproduce the results in the paper for benchmark evaluation and training, you will need to setup dataset. The original images and annotations are all stored in the csv files. You can easily convert them into different formats based on your requirements. For example, retail50k2coco.py. Be noted that due to the size limitation in github, the training data is split into two csv files. You should use the training data from both files.

Training data

${CenterNet_ROOT}
|-- retail50k
`-- |-- retail50k_train1.csv
`-- |-- retail50k_train2.csv

Testing data

${CenterNet_ROOT}
|-- retail50k
`-- |-- retail50k_test.csv

piou's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

piou's Issues

Missing annotations

First, I want to thank you for your amazing work. I have some questions regarding the Retail50K dataset

  1. I have downloaded the Retail50K dataset and tried visualizing some images with polygon labels. I noticed that there are some potential missing annotations. For example, ID 122645 has a bottom row with price tags but that row is not annotated. I think missing annotation can lead to high False Negative of the trained model, and there is quite a lot of missing annotation cases like this. Can you verfify some missing annotations?
  2. In the csv files I noticed that the field 'ProductId' has 2 possible values: 1 and 1000050. After visualizing some samples, I assume that 1 means "row" and 1000050 means "nearby shelves". Is this correct?

torch/extension.h: 没有那个文件或目录

When excuting the command "cd $CenterNet_ROOT/src/lib/piou_loss python setup.py install"
there is an erreor as below,I want to know why is there such a problem and how to solve it.
Looking forward too your reply,thanks.
image

Cannot download the dataset

Hi, I want to download the Retail50K dataset from the csv. I used a python script with 'requests.get' to get the image from urls and save to my disk. It runs very slowly and after downloading several images, it raises an error "requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))". I wonder how I can download this dataset faster and safer. Thanks in adavance!

Training and Evaluation Configuration for HRSC2016 Missing

Dear authors,

I've read through your work and was surprised by your performance on the HRSC2016 benchmark. On further investigation, I found out that you, unfortunately, haven't published any details regarding this benchmark. I would be interested in the training configuration, as well as the evaluation procedure, in particular, whether you are using VOC07 or VOC12 as the evaluation metric.

MMdetection PIoU Loss

Do you have a working code of PIoU Loss implemented in MMDetection? I just want to try it using different SoA oriented object detection methods.

how to use piou loss in Mask RCNN-based methods?

Hello, I want to replace Piou loss with Smoothl1 loss in the Mask rcnn-based instance segmentation method. I want to confirm whether I only need to replace Smoothl1 loss in RPN and Roi head with Piou loss? In addition, batch['cat_spec_mask'] in ctdet_angle.py is the segmentation label of the instance? Looking forward for your response, thank you.

logdir is chaotic(目录有点混乱)

在各文件之间的引用中,文件目录是混乱的,比如在main.py中,前面导入包的时候的语句,那些被引用的文件与main.py不是同一级的,但是直接引用了,导致错误,对目录层级判定不准确。另外,比如,main.py中的“from datasets.dataset_factory import get_dataset”,首先如上,datasets文件夹在lib下,与main.py不同级,此外,datasets文件夹里并没有dataset_factory文件,又如何import get_dataset?与datasets相邻的detector文件夹倒是有detector_factory.py文件,但是其中并没有get_dataset函数。
请作者明示。
多个issue也没见作者回复,作者已不再使用github?

How can i generate the rotation angle?

can you describe how to calculate rotation angle of a rotated rectangle in labelTxt of DOTA1.5?
Can i use cv2.minAreaRect() to get the angle directly?

angle_loss can't convergence,otherwise other loss can?

In the case of using different backbones, various experiments have shown that only the angle_loss of the backbone of dla34_dcn can converge. Other backbones include resdcn_50, 101, and dlav0_34. Angle_loss cannot effectively converge. The loss of other heads performs well. This problem may be What is it? Dimension of angle? Feel the wild? still is?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.