From 381d6adeaa3f121e63ecf1315074880508d5ed1a Mon Sep 17 00:00:00 2001 From: harshada Date: Wed, 4 Nov 2026 05:33:35 +0000 Subject: [PATCH] Update README.md --- README.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8872fe0..dbf9e14 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,105 @@ -# image-classification +# Task 05: Image Classification Using Python -Real-time image classification using the Logitech BRIO 100 camera and trained deep learning models. \ No newline at end of file +## Task Title + +Image Classification Using Python + +## Description + +Implement and test the `05_classification.py` script on the Jetson Orin Nano. Runs YOLO26n-cls to give one label for the WHOLE frame (top predictions with probabilities from the 1000 ImageNet classes). No boxes are drawn. + +## When to Use + +Use this when the image contains one main subject and you only need to know what it is, for example sorting products or identifying a held object. + +## Hardware and Software + +- Device: NVIDIA Jetson Orin Nano (JetPack with CUDA and TensorRT) +- Camera: USB webcam (for example Logitech BRIO 100) at CAMERA_INDEX 0 +- Language: Python 3 +- Model: YOLO26 (Ultralytics), weights `yolo26n-cls.pt` +- Libraries: ultralytics, opencv-python, numpy + +## Installation + +``` +pip install ultralytics opencv-python +``` + +On Jetson, install the JetPack-matched PyTorch and torchvision builds first (see the Ultralytics Jetson guide in the references). Model weights download automatically on first run if the machine is online. + +## Command to Run + +``` +python3 05_classification.py +``` + +Check the camera is visible before running: + +``` +ls /dev/video* +``` + +## How It Works + +1. Load the classification weights (yolo26n-cls.pt). +2. Open the camera feed. +3. Run the model on each frame. +4. Read the top-1 (and top-5) class names and probabilities. +5. Overlay the label, probability and FPS. Press Q to quit. + +## Settings You Can Change + +Edit these values at the top of the script: + +- CAMERA_INDEX, FRAME_W, FRAME_H : camera options +- Top-K predictions shown +- MODEL_WEIGHTS = yolo26n-cls.pt +- Input size, normally 224 + +## Controls + +- Press `Q` to quit the live window + +## Verify the Output + +Run `python3 05_classification.py` and confirm: + +- [ ] A live window opens with a class label and probability at the top. +- [ ] The label changes when you show a different object to the camera. +- [ ] No bounding boxes appear; Q closes the window. + +## Optional: Faster Inference with TensorRT + +For higher FPS on the Orin Nano, export the model to a TensorRT engine once and point `MODEL_WEIGHTS` to the engine file: + +``` +yolo export model=yolo26n-cls.pt format=engine half=True +``` + +Then set `MODEL_WEIGHTS = 'yolo26n-cls.engine'` in the script. + +## Troubleshooting + +- Camera not opening: check `ls /dev/video*`, try CAMERA_INDEX 1, and make sure no other app is using the camera. +- Window does not show over SSH: run on the Jetson desktop, or use X11 forwarding. +- Low FPS: use the nano model, lower FRAME_W / FRAME_H, run `sudo nvpmodel -m 0` and `sudo jetson_clocks`, or export to TensorRT. +- Weights not found: connect to the internet for the first run or copy the .pt file next to the script. +- Out of memory: close other apps and reduce the input size. + +## How This Differs From the Other Tasks + +Labels the whole frame with one class, no boxes at all. + +Files in this folder: 01_detection, 02_tracking, 03_segmentation, 04_pose_estimation, 05_classification, 06_roi_detection, 07_obb_detection, 08_depth_estimation. + +## References + +- [Image classification task docs](https://docs.ultralytics.com/tasks/classify/) +- [ImageNet dataset](https://docs.ultralytics.com/datasets/classify/imagenet/) +- [Ultralytics YOLO26 model page](https://docs.ultralytics.com/models/yolo26/) +- [ImageNet class list](https://github.com/ultralytics/yolov5/blob/master/data/ImageNet.yaml) +- [Ultralytics on NVIDIA Jetson guide](https://docs.ultralytics.com/guides/nvidia-jetson/) +- [TensorRT export](https://docs.ultralytics.com/integrations/tensorrt/) +- [Ultralytics GitHub](https://github.com/ultralytics/ultralytics) +- [JetPack SDK](https://developer.nvidia.com/embedded/jetpack) \ No newline at end of file