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}
}

You might also like...
Open source code for Paper
Open source code for Paper "A Co-Interactive Transformer for Joint Slot Filling and Intent Detection"

A Co-Interactive Transformer for Joint Slot Filling and Intent Detection This repository contains the PyTorch implementation of the paper: A Co-Intera

Source code of "Hold me tight! Influence of discriminative features on deep network boundaries"

Hold me tight! Influence of discriminative features on deep network boundaries This is the source code to reproduce the experiments of the NeurIPS 202

The open source code of SA-UNet: Spatial Attention U-Net for Retinal Vessel Segmentation.
The open source code of SA-UNet: Spatial Attention U-Net for Retinal Vessel Segmentation.

SA-UNet: Spatial Attention U-Net for Retinal Vessel Segmentation(ICPR 2020) Overview This code is for the paper: Spatial Attention U-Net for Retinal V

Source code, datasets and trained models for the paper Learning Advanced Mathematical Computations from Examples (ICLR 2021), by François Charton, Amaury Hayat (ENPC-Rutgers) and Guillaume Lample

Maths from examples - Learning advanced mathematical computations from examples This is the source code and data sets relevant to the paper Learning a

Source Code for DialogBERT: Discourse-Aware Response Generation via Learning to Recover and Rank Utterances (https://arxiv.org/pdf/2012.01775.pdf)

DialogBERT This is a PyTorch implementation of the DialogBERT model described in DialogBERT: Neural Response Generation via Hierarchical BERT with Dis

Implementation of the paper
Implementation of the paper "Language-agnostic representation learning of source code from structure and context".

Code Transformer This is an official PyTorch implementation of the CodeTransformer model proposed in: D. Zügner, T. Kirschstein, M. Catasta, J. Leskov

source code and pre-trained/fine-tuned checkpoint for NAACL 2021 paper LightningDOT
source code and pre-trained/fine-tuned checkpoint for NAACL 2021 paper LightningDOT

LightningDOT: Pre-training Visual-Semantic Embeddings for Real-Time Image-Text Retrieval This repository contains source code and pre-trained/fine-tun

Code to reproduce the experiments in the paper
Code to reproduce the experiments in the paper "Transformer Based Multi-Source Domain Adaptation" (EMNLP 2020)

Transformer Based Multi-Source Domain Adaptation Dustin Wright and Isabelle Augenstein To appear in EMNLP 2020. Read the preprint: https://arxiv.org/a

Source code for the GPT-2 story generation models in the EMNLP 2020 paper "STORIUM: A Dataset and Evaluation Platform for Human-in-the-Loop Story Generation"

Storium GPT-2 Models This is the official repository for the GPT-2 models described in the EMNLP 2020 paper [STORIUM: A Dataset and Evaluation Platfor

Owner
Woody. Wang
Woody. Wang
Implementation of the algorithm shown in the article "Modelo de Predicción de Éxito de Canciones Basado en Descriptores de Audio"

Success Predictor Implementation of the algorithm shown in the article "Modelo de Predicción de Éxito de Canciones Basado en Descriptores de Audio". B

Rodrigo Nazar Meier 4 Mar 17, 2022
Empirical Study of Transformers for Source Code & A Simple Approach for Handling Out-of-Vocabulary Identifiers in Deep Learning for Source Code

Transformers for variable misuse, function naming and code completion tasks The official PyTorch implementation of: Empirical Study of Transformers fo

Bayesian Methods Research Group 56 Nov 15, 2022
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.

简体中文 | English PaddleRobotics paddleRobotics是基于paddle的机器人开源算法库集,包括人机交互、复杂运动控制、环境感知、slam定位导航等开源算法部分。 人机交互 主动多模交互技术TFVT-HRI 主动多模交互技术是通过视觉、语音、触摸传感器等输入机器人

null 185 Dec 26, 2022
Source-to-Source Debuggable Derivatives in Pure Python

Tangent Tangent is a new, free, and open-source Python library for automatic differentiation. Existing libraries implement automatic differentiation b

Google 2.2k Jan 1, 2023
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Graph Transformer Architecture. Source code for

Graph Transformer Architecture Source code for the paper "A Generalization of Transformer Networks to Graphs" by Vijay Prakash Dwivedi and Xavier Bres

NTU Graph Deep Learning Lab 561 Jan 8, 2023
Open source repository for the code accompanying the paper 'Non-Rigid Neural Radiance Fields Reconstruction and Novel View Synthesis of a Deforming Scene from Monocular Video'.

Non-Rigid Neural Radiance Fields This is the official repository for the project "Non-Rigid Neural Radiance Fields: Reconstruction and Novel View Synt

Facebook Research 296 Dec 29, 2022
Source code for Acorn, the precision farming rover by Twisted Fields

Acorn precision farming rover This is the software repository for Acorn, the precision farming rover by Twisted Fields. For more information see twist

Twisted Fields 198 Jan 2, 2023
[CVPR2021] The source code for our paper 《Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Learning》.

TBE The source code for our paper "Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Le

Jinpeng Wang 150 Dec 28, 2022