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
A tensorflow/keras implementation of StyleGAN to generate images of new Pokemon.

PokeGAN A tensorflow/keras implementation of StyleGAN to generate images of new Pokemon. Dataset The model has been trained on dataset that includes 8

19 Jul 26, 2022
Implementation of a Transformer that Ponders, using the scheme from the PonderNet paper

Ponder(ing) Transformer Implementation of a Transformer that learns to adapt the number of computational steps it takes depending on the difficulty of

Phil Wang 65 Oct 04, 2022
Official code for "Maximum Likelihood Training of Score-Based Diffusion Models", NeurIPS 2021 (spotlight)

Maximum Likelihood Training of Score-Based Diffusion Models This repo contains the official implementation for the paper Maximum Likelihood Training o

Yang Song 84 Dec 12, 2022
Towards Improving Embedding Based Models of Social Network Alignment via Pseudo Anchors

PSML paper: Towards Improving Embedding Based Models of Social Network Alignment via Pseudo Anchors PSML_IONE,PSML_ABNE,PSML_DEEPLINK,PSML_SNNA: numpy

13 Nov 27, 2022
Data, notebooks, and articles associated with the RSNA AI Deep Learning Lab at RSNA 2021

RSNA AI Deep Learning Lab 2021 Intro Welcome Deep Learners! This document provides all the information you need to participate in the RSNA AI Deep Lea

RSNA 65 Dec 16, 2022
Pretrained Pytorch face detection (MTCNN) and recognition (InceptionResnet) models

Face Recognition Using Pytorch Python 3.7 3.6 3.5 Status This is a repository for Inception Resnet (V1) models in pytorch, pretrained on VGGFace2 and

Tim Esler 3.3k Jan 04, 2023
A "gym" style toolkit for building lightweight Neural Architecture Search systems

A "gym" style toolkit for building lightweight Neural Architecture Search systems

Jack Turner 12 Nov 05, 2022
Implementation of the paper ''Implicit Feature Refinement for Instance Segmentation''.

Implicit Feature Refinement for Instance Segmentation This repository is an official implementation of the ACM Multimedia 2021 paper Implicit Feature

Lufan Ma 17 Dec 28, 2022
Self-supervised Multi-modal Hybrid Fusion Network for Brain Tumor Segmentation

JBHI-Pytorch This repository contains a reference implementation of the algorithms described in our paper "Self-supervised Multi-modal Hybrid Fusion N

FeiyiFANG 5 Dec 13, 2021
Image marine sea litter prediction Shiny

MARLITE Shiny app for floating marine litter detection in aerial images. This directory contains the instructions and software needed to install the S

19 Dec 22, 2022
Code for the paper "Multi-task problems are not multi-objective"

Multi-Task problems are not multi-objective This is the code for the paper "Multi-Task problems are not multi-objective" in which we show that the com

Michael Ruchte 5 Aug 19, 2022
Self-supervised learning optimally robust representations for domain generalization.

OptDom: Learning Optimal Representations for Domain Generalization This repository contains the official implementation for Optimal Representations fo

Yangjun Ruan 18 Aug 25, 2022
My tensorflow implementation of "A neural conversational model", a Deep learning based chatbot

Deep Q&A Table of Contents Presentation Installation Running Chatbot Web interface Results Pretrained model Improvements Upgrade Presentation This wor

Conchylicultor 2.9k Dec 28, 2022
A simple tutoral for error correction task, based on Pytorch

gramcorrector A simple tutoral for error correction task, based on Pytorch Grammatical Error Detection (sentence-level) a binary sequence-based classi

peiyuan_gong 8 Dec 03, 2022
Efficient Two-Step Networks for Temporal Action Segmentation (Neurocomputing 2021)

Efficient Two-Step Networks for Temporal Action Segmentation This repository provides a PyTorch implementation of the paper Efficient Two-Step Network

8 Apr 16, 2022
Kaggle G2Net Gravitational Wave Detection : 2nd place solution

Kaggle G2Net Gravitational Wave Detection : 2nd place solution

Hiroshechka Y 33 Dec 26, 2022
Create Data & AI apps in 20 lines of code with Shimoku

Install with: pip install shimoku-api-python Start with: from os import getenv import shimoku_api_python.client as Shimoku

Shimoku 5 Nov 07, 2022
Ankou: Guiding Grey-box Fuzzing towards Combinatorial Difference

Ankou Ankou is a source-based grey-box fuzzer. It intends to use a more rich fitness function by going beyond simple branch coverage and considering t

SoftSec Lab 54 Dec 24, 2022
Resilient projection-based consensus actor-critic (RPBCAC) algorithm

Resilient projection-based consensus actor-critic (RPBCAC) algorithm We implement the RPBCAC algorithm with nonlinear approximation from [1] and focus

Martin Figura 5 Jul 12, 2022
Scheduling BilinearRewards

Scheduling_BilinearRewards Requirement Python 3 =3.5 Structure main.py This file includes the main function. For getting the results in Figure 1, ple

junghun.kim 0 Nov 25, 2021