Get Started
In Anaconda Prompt or the Terminal
cd your_directory
Creating new virtual environment
Create new folder name: "sign_project" on your directory. Put your own environment name instead of "envName" or you can you this name.
mkdir sign_project
cd sign_project
python -m venv envName
Activate your environment
envName\Scripts\activate.bat
Using Git clone to set up the model tools
Open Visual Studio Code (VScode)
In Visual Studio Code (VScode)
Open detect.ipynb
on yolov5
folder and
Open New Terminal in Vscode (command Prompt)
Import module and set up tools
In detect.ipynb
Detection Sign image
The detect.py
run ThTaxSign model on all images source of data/images
folder and save the result to output/exp
folders.
This case study have two images source on data/images
folder.
# use ThTaxSign model to detect
!python detect.py --img 640 --weights ThTaxSigns/data/models.pt --conf 0.3 --source ThTaxSigns/data/images --project ThTaxSigns/data/output --save-crop
--img
: inference size (height, width)
--weights
: model path or triton URL
--conf
: confidence threshold
--source
: file/dir/URL/glob/screen/webcam (source of the image)
--project
: save results to project/name
--save-crop
: save cropped prediction boxes
Other option you can read more !!!
Display output
# Display image
import glob
from IPython.display import Image, display
for imageName in glob.glob('ThTaxSigns/data/output/exp/*.jpg'):
display(Image(filename=imageName))
print("\n")
Display crop output
This tool will separatly crop the sign image output to several image files.
# Display all crop images
for imageName in glob.glob('ThTaxSigns/data/output/exp/crops/unidentified_signs/*.jpg'):
display(Image(filename=imageName,width=300))
print("\n")
Finally, you can see these crop image outputs on output/exp/crops/unidentified_signs
folder.