Detect and draw bounding boxes around objects in your own photos using pre-trained YOLOv4 weights
Train a custom object detection model on your own labeled image dataset
Convert a trained YOLOv4 model to TensorRT format for much faster inference on NVIDIA GPUs
Export the model to ONNX format to use it across different AI tools and runtimes
TensorRT conversion requires an NVIDIA GPU with CUDA, basic inference can run on CPU but is significantly slower.
YOLOv4 is an object detection algorithm, meaning software that looks at a photo and draws boxes around things it recognizes, such as people, cars, or animals. This repository is a Python version of that algorithm built with PyTorch, a popular machine-learning framework. It lets you run the detection model on your own images and also train the model on new data you supply. Out of the box, the project supports both running predictions (called inference) and training from scratch or from pre-trained weight files. The author provides download links for pre-trained model files so you do not have to train from scratch if you just want to try it out. You load one of these files, point the script at an image, and the model returns the coordinates of detected objects along with confidence scores for each recognized category. One significant capability is converting the PyTorch model into other formats: ONNX and TensorRT. ONNX is a standard interchange format that makes AI models portable across different tools and runtimes. TensorRT is a format optimized for running on NVIDIA graphics hardware, which can meaningfully speed up how fast the model processes images. The repository includes separate conversion scripts for each step, taking the model from the original Darknet format through PyTorch and ONNX to a final TensorRT engine file. The project also supports flexible image input sizes rather than locking you into a single fixed dimension. You can adjust width and height in increments of 96 pixels starting from 320, giving you control over the trade-off between accuracy on small objects and processing speed. Performance benchmarks on the standard MS COCO test dataset show the PyTorch version achieves accuracy close to the original Darknet implementation, and the TensorRT versions maintain similar accuracy while running faster on compatible hardware.
← tianxiaomo on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.