yolov12-tubro/readme.md
Yolov12 model supports TensorRT-8.
Detection training code link Segment training codelink Classify training codelink
# You are supposed to train your own models instead of using the pre-trained models
# to download other models, replace 'yolov12n.pt' with 'yolov12s.pt', 'yolov12m.pt', 'yolov12l.pt' or 'yolov12x.pt'
# Generate .wts
cp [PATH-TO-TENSORRTX]/yolov12/gen_wts.py .
python gen_wts.py -w yolov12n.pt -o yolov12n.wts -t detect
# A file 'yolov12n.wts' will be generated.
cd [PATH-TO-TENSORRTX]/yolov12
mkdir build
cd build
cmake ..
make
# You are supposed to train your own models instead of using the pre-trained models
to download other models, replace 'yolov12n-seg.pt' with 'yolov12s-seg.pt', 'yolov12m-seg.pt', 'yolov12l-seg.pt' or 'yolov12x-seg.pt'
# Generate .wts
cp [PATH-TO-TENSORRTX]/yolov12/gen_wts.py .
python gen_wts.py -w yolov12n.pt -o yolov12n.wts -t seg
# A file 'yolov12n.wts' will be generated.
cd [PATH-TO-TENSORRTX]/yolov12
mkdir build
cd build
cmake ..
make
# Download ultralytics
# You are supposed to train your own models instead of using the pre-trained models
to download other models, replace 'yolov12n-cls.pt' with 'yolov12s-cls.pt', 'yolov12m-cls.pt', 'yolov12l-cls.pt' or 'yolov12x-cls.pt'
# Generate .wts
cp [PATH-TO-TENSORRTX]/yolov12/gen_wts.py .
python gen_wts.py -w yolov12n-cls.pt -t cls -o yolov12n-cls.wts
# A file 'yolov12n-cls.wts' will be generated.
cd [PATH-TO-TENSORRTX]/yolov12
mkdir build
cd build
cmake ..
make
cp [PATH-TO-ultralytics]/yolov12n.wts .
# Build and serialize TensorRT engine
./yolov12_det -s yolov12n.wts yolov12n.engine [n/s/m/l/x]
# Run inference
./yolov12_det -d yolov12n.engine ../images [c/g]
# results saved in build directory
cp [PATH-TO-ultralytics]/yolov2n-seg.wts .
# Build and serialize TensorRT engine
./yolov12-seg -s yolov12n-seg.wts yolov12n-seg.engine [n/s/m/l/x]
# Run inference
./yolov12-seg -d yolov12n-seg.engine ../images
# results saved in build directory
cp [PATH-TO-ultralytics]/yolov2n-cls.wts .
# Build and serialize TensorRT engine
./yolov12-cls -s yolov12n-cls.wts yolov12n-cls.engine [n/s/m/l/x]
# Run inference
./yolov12-cls -d yolov12n-cls.engine ../images
# results saved in build directory
## More Information
See the readme in [home page.](https://github.com/wang-xinyu/tensorrtx)