Skip to content

Commit

Permalink
Fix main and add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca committed Jan 5, 2021
1 parent ae40ddb commit 759b403
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# AGC - Nuvi RecycleNet
Effective trash detection model for AI Grand Challenge 2020 track 3 round 1.
Nuvilabs Solution.
The classes to be detected are:

- combustion
- paper
- steel
- glass
- plastic
- plasticbag
- styrofoam
- food

## Usage
Download the pretrained model

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1LnCw4L8RnM3qM96czxTTsOHn3xAKEpya' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1LnCw4L8RnM3qM96czxTTsOHn3xAKEpya" -O ./model/model_checkpoint.pth && rm -rf /tmp/cookies.txt


Run inference

python main.py --img_path ./sample_img.jpg
Will return a dictionary with the following format:
{'Annotations': [{'Label': 'steel', 'Bbox': [564, 383, 695, 443], 'Confidence': 0.9856872}]}
The bbox format follows: [xmin, ymin, xmax, ymax]
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import argparse
import os.path as osp
import glob
from drs_infer import Nuvi_RecycleNet
from inference import Nuvi_RecycleNet


parser = argparse.ArgumentParser(
Expand All @@ -19,7 +19,7 @@
help='Model checkpoint file path.')
parser.add_argument('--img_path', default='./sample_img.jpg', type=str,
help='Path of image or images.')
parser.add_argument('--threshold', default=0.5, type=float,
parser.add_argument('--threshold', default=0.6, type=float,
help='Only boxes with the score larger than this will be detected.')
parser.add_argument('--use_tta', dest='use_tta', action='store_true',
help='Either use TTA to help detect images.')
Expand Down

0 comments on commit 759b403

Please sign in to comment.