Source code of article "Towards Toxic and Narcotic Medication Detection with Rotated Object Detector"

Overview

Towards Toxic and Narcotic Medication Detection with Rotated Object Detector

Introduction

This is the source code of article: Towards Toxic and Narcotic Medication Detection with Rotated Object Detector
The orgnization of this repo looks like this:

.
├── configs 
│   ├── cfg_ro.yml # main config file for rotated yolo-v5
│   ├── cfg.yml    # main config file for yolo-v5
│   ├── model_pt   # model config files
│   │   ├── yolov5s_ro.yml
│   │   └── yolov5s.yml
│   ├── nms        # config file for nms
│   │   └── extra_filter.json
│   └── pipeline   # config file for data augmentation
│       └── aug_cfg.yml
├── pipeline       # Analogy to Dataset in Pytorch
│   ├── augment.py 
│   └── dataset.py
├── pt             # Pytorch specific implementation
│   ├── common.py  # DL basic modules
│   ├── loss.py    # loss function ralated for yolo-v5
│   ├── loss_ro.py # loss function ralated for rotated yolo-v5
│   ├── metric.py  # Evaluation ralated
│   ├── server.py  # Main classes for training validation and inference
│   ├── utils.py   # Pytorch specific utilities
│   ├── yolo.py    # Model classes of yolo-v5
│   ├── yolo_ro.py # Model classes of rotated yolo-v5
│   └── log        
│       └── ...    # Where do we save the trained parameters (.pt)
├── tools          # Helper functions
│   ├── colormap.py
│   ├── compress.py
│   ├── const.py
│   ├── plot.py
│   └── utils.py   # Framework independent utilities
├── plot4latex.ipynb # How do we get the figures in the article
├── train.py       # Command for training 
└── infer.py       # Set up an inference http server

How to Get Started

Prerequisite

Class id in .txt label file has already been transfered to the index number we finally use in training and inference. There should be a yolo_label_id2name.json file saving the mapping.
All the tunable arguments are listed in configs/cfg_ro.yml for rotated yolo-v5 and configs/cfg.yml for yolo-v5. It's almost self-explainable, feel free to play with it please.

Training

For rotated yolo-v5:
python train.py --cfg=configs/cfg_ro.yml

For yolo-v5:
python train.py --cfg=configs/cfg.yml

Inference

For rotated yolo-v5:
python infer.py --cfg=configs/cfg_ro.yml

For yolo-v5:
python infer.py --cfg=configs/cfg.yml

This would start up an inference http server with the best-shot trained parameters.

Development Environment

RTX 3060 (12GB GPU Memory) CUDA 11.2 Python 3.8 python packages: requirements.txt

Acknowledgment

This work refers a lot to ultralytics/yolov5 and BossZard/rotation-yolov5. We deeply appreciate their contributions to the community.

Citation

Bibtex

@article{adam,
  title={Towards Toxic and Narcotic Medication Detection with Rotated Object Detector},
  author={Peng, Jiao and Wang, Feifan and Fu, Zhongqiang and Hu, Yiying and Chen, Zichen and Zhou, Xinghan and Wang, Lijun},
  journal={arXiv preprint arXiv:2110.09777},
  year={2021},
  url={https://arxiv.org/abs/2110.09777}
}

Owner
Woody. Wang
Woody. Wang
Wikidated : An Evolving Knowledge Graph Dataset of Wikidata’s Revision History

Wikidated Wikidated 1.0 is a dataset of Wikidata’s full revision history, which encodes changes between Wikidata revisions as sets of deletions and ad

Lukas Schmelzeisen 11 Aug 16, 2022
Fast (simple) spectral synthesis and emission-line fitting of DESI spectra.

FastSpecFit Introduction This repository contains code and documentation to perform fast, simple spectral synthesis and emission-line fitting of DESI

5 Aug 02, 2022
Computations and statistics on manifolds with geometric structures.

Geomstats Code Continuous Integration Code coverage (numpy) Code coverage (autograd, tensorflow, pytorch) Documentation Community NEWS: Geomstats is r

875 Dec 31, 2022
The Curious Layperson: Fine-Grained Image Recognition without Expert Labels (BMVC 2021)

The Curious Layperson: Fine-Grained Image Recognition without Expert Labels Subhabrata Choudhury, Iro Laina, Christian Rupprecht, Andrea Vedaldi Code

Subhabrata Choudhury 18 Dec 27, 2022
Clockwork Variational Autoencoder

Clockwork Variational Autoencoders (CW-VAE) Vaibhav Saxena, Jimmy Ba, Danijar Hafner If you find this code useful, please reference in your paper: @ar

Vaibhav Saxena 35 Nov 06, 2022
Demonstrational Session git repo for H SAF User Workshop (28/1)

5th H SAF User Workshop The 5th H SAF User Workshop supported by EUMeTrain will be held in online in January 24-28 2022. This repository contains inst

H SAF 4 Aug 04, 2022
Gesture Volume Control Using OpenCV and MediaPipe

This Project Uses OpenCV and MediaPipe Hand solutions to identify hands and Change system volume by taking thumb and index finger positions

Pratham Bhatnagar 6 Sep 12, 2022
Official implementation of "Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets" (CVPR2021)

Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets This is the official implementation of "Towards Good Pract

Sanja Fidler's Lab 52 Nov 22, 2022
AsymmetricGAN - Dual Generator Generative Adversarial Networks for Multi-Domain Image-to-Image Translation

AsymmetricGAN for Image-to-Image Translation AsymmetricGAN Framework for Multi-Domain Image-to-Image Translation AsymmetricGAN Framework for Hand Gest

Hao Tang 42 Jan 15, 2022
face2comics by Sxela (Alex Spirin) - face2comics datasets

This is a paired face to comics dataset, which can be used to train pix2pix or similar networks.

Alex 164 Nov 13, 2022
A PyTorch-centric hybrid classical-quantum machine learning framework

torchquantum A PyTorch-centric hybrid classical-quantum dynamic neural networks framework. News Add a simple example script using quantum gates to do

MIT HAN Lab 400 Jan 02, 2023
unet for image segmentation

Implementation of deep learning framework -- Unet, using Keras The architecture was inspired by U-Net: Convolutional Networks for Biomedical Image Seg

zhixuhao 4.1k Dec 31, 2022
Bravia core script for python

Bravia-Core-Script You need to have a mandatory account If this L3 does not work, try another L3. enjoy

5 Dec 26, 2021
Implementation for the paper 'YOLO-ReT: Towards High Accuracy Real-time Object Detection on Edge GPUs'

YOLO-ReT This is the original implementation of the paper: YOLO-ReT: Towards High Accuracy Real-time Object Detection on Edge GPUs. Prakhar Ganesh, Ya

69 Oct 19, 2022
Code for generating a single image pretraining dataset

Single Image Pretraining of Visual Representations As shown in the paper A critical analysis of self-supervision, or what we can learn from a single i

Yuki M. Asano 12 Dec 19, 2022
Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX.

scc4onnx Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel

Katsuya Hyodo 16 Dec 22, 2022
Sinkformers: Transformers with Doubly Stochastic Attention

Code for the paper : "Sinkformers: Transformers with Doubly Stochastic Attention" Paper You will find our paper here. Compat This package has been dev

Michael E. Sander 31 Dec 29, 2022
GLIP: Grounded Language-Image Pre-training

GLIP: Grounded Language-Image Pre-training Updates 12/06/2021: GLIP paper on arxiv https://arxiv.org/abs/2112.03857. Code and Model are under internal

Microsoft 862 Jan 01, 2023
A PyTorch Implementation of FaceBoxes

FaceBoxes in PyTorch By Zisian Wong, Shifeng Zhang A PyTorch implementation of FaceBoxes: A CPU Real-time Face Detector with High Accuracy. The offici

Zi Sian Wong 797 Dec 17, 2022
Time-Optimal Planning for Quadrotor Waypoint Flight

Time-Optimal Planning for Quadrotor Waypoint Flight This is an example implementation of the paper "Time-Optimal Planning for Quadrotor Waypoint Fligh

Robotics and Perception Group 38 Dec 02, 2022