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
K Closest Points and Maximum Clique Pruning for Efficient and Effective 3D Laser Scan Matching (To appear in RA-L 2022)

KCP The official implementation of KCP: k Closest Points and Maximum Clique Pruning for Efficient and Effective 3D Laser Scan Matching, accepted for p

Yu-Kai Lin 109 Dec 14, 2022
The Noise Contrastive Estimation for softmax output written in Pytorch

An NCE implementation in pytorch About NCE Noise Contrastive Estimation (NCE) is an approximation method that is used to work around the huge computat

Kaiyu Shi 287 Nov 25, 2022
Fully Connected DenseNet for Image Segmentation

Fully Connected DenseNets for Semantic Segmentation Fully Connected DenseNet for Image Segmentation implementation of the paper The One Hundred Layers

Somshubra Majumdar 84 Oct 31, 2022
Official Repo for Ground-aware Monocular 3D Object Detection for Autonomous Driving

Visual 3D Detection Package: This repo aims to provide flexible and reproducible visual 3D detection on KITTI dataset. We expect scripts starting from

Yuxuan Liu 305 Dec 19, 2022
ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator

ONNX Runtime is a cross-platform inference and training machine-learning accelerator. ONNX Runtime inference can enable faster customer experiences an

Microsoft 8k Jan 04, 2023
ICLR21 Tent: Fully Test-Time Adaptation by Entropy Minimization

⛺️ Tent: Fully Test-Time Adaptation by Entropy Minimization This is the official project repository for Tent: Fully-Test Time Adaptation by Entropy Mi

Dequan Wang 204 Dec 25, 2022
Official PyTorch implementation of "Preemptive Image Robustification for Protecting Users against Man-in-the-Middle Adversarial Attacks" (AAAI 2022)

Preemptive Image Robustification for Protecting Users against Man-in-the-Middle Adversarial Attacks This is the code for reproducing the results of th

2 Dec 27, 2021
Distance-Ratio-Based Formulation for Metric Learning

Distance-Ratio-Based Formulation for Metric Learning Environment Python3 Pytorch (http://pytorch.org/) (version 1.6.0+cu101) json tqdm Preparing datas

Hyeongji Kim 1 Dec 07, 2022
Bag of Tricks for Natural Policy Gradient Reinforcement Learning

Bag of Tricks for Natural Policy Gradient Reinforcement Learning [ArXiv] Setup Python 3.8.0 pip install -r req.txt Mujoco 200 license Main Files main.

Brennan Gebotys 1 Oct 10, 2022
Source code related to the article submitted to the International Conference on Computational Science ICCS 2022 in London

POTHER: Patch-Voted Deep Learning-based Chest X-ray Bias Analysis for COVID-19 Detection Source code related to the article submitted to the Internati

Tomasz Szczepański 1 Apr 29, 2022
This is the official implementation for "Do Transformers Really Perform Bad for Graph Representation?".

Graphormer By Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng*, Guolin Ke, Di He*, Yanming Shen and Tie-Yan Liu. This repo is the official impl

Microsoft 1.3k Dec 29, 2022
UniFormer - official implementation of UniFormer

UniFormer This repo is the official implementation of "Uniformer: Unified Transformer for Efficient Spatiotemporal Representation Learning". It curren

SenseTime X-Lab 573 Jan 04, 2023
Awesome AI Learning with +100 AI Cheat-Sheets, Free online Books, Top Courses, Best Videos and Lectures, Papers, Tutorials, +99 Researchers, Premium Websites, +121 Datasets, Conferences, Frameworks, Tools

All about AI with Cheat-Sheets(+100 Cheat-sheets), Free Online Books, Courses, Videos and Lectures, Papers, Tutorials, Researchers, Websites, Datasets

Niraj Lunavat 1.2k Jan 01, 2023
Car Price Predictor App used to predict the price of the car based on certain input parameters created using python's scikit-learn, fastapi, numpy and joblib packages.

Pricefy Car Price Predictor App used to predict the price of the car based on certain input parameters created using python's scikit-learn, fastapi, n

Siva Prakash 1 May 10, 2022
Underwater image enhancement

LANet Our work proposes an adaptive learning attention network (LANet) to solve the problem of color casts and low illumination in underwater images.

LiuShiBen 7 Sep 14, 2022
This repository contains several image-to-image translation models, whcih were tested for RGB to NIR image generation. The models are Pix2Pix, Pix2PixHD, CycleGAN and PointWise.

RGB2NIR_Experimental This repository contains several image-to-image translation models, whcih were tested for RGB to NIR image generation. The models

5 Jan 04, 2023
This is my codes that can visualize the psnr image in testing videos.

CVPR2018-Baseline-PSNRplot This is my codes that can visualize the psnr image in testing videos. Future Frame Prediction for Anomaly Detection – A New

Wenhao Yang 12 May 29, 2021
Set of methods to ensemble boxes from different object detection models, including implementation of "Weighted boxes fusion (WBF)" method.

Set of methods to ensemble boxes from different object detection models, including implementation of "Weighted boxes fusion (WBF)" method.

1.4k Jan 05, 2023
Repository of best practices for deep learning in Julia, inspired by fastai

FastAI Docs: Stable | Dev FastAI.jl is inspired by fastai, and is a repository of best practices for deep learning in Julia. Its goal is to easily ena

FluxML 532 Jan 02, 2023
DIVeR: Deterministic Integration for Volume Rendering

DIVeR: Deterministic Integration for Volume Rendering This repo contains the training and evaluation code for DIVeR. Setup python 3.8 pytorch 1.9.0 py

64 Dec 27, 2022