From b9a69c6a4fb0caa0f3c3c9b2175937f6e24b1add Mon Sep 17 00:00:00 2001 From: harshada Date: Wed, 4 Nov 2026 05:36:04 +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 bd194f8..090aad8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,105 @@ -# depth-estimation +# Task 08: Depth / Distance Estimation Using Python -Real-time depth estimation using the Logitech BRIO 100 camera and deep learning models, with depth map visualization \ No newline at end of file +## Task Title + +Depth / Distance Estimation Using Python + +## Description + +Implement and test the `08_depth_estimation.py` script on the Jetson Orin Nano. Estimates how far away objects are from the camera and shows the distance next to each detected object on the live feed. + +## When to Use + +Use this for obstacle awareness, robotics, safe-distance checks and any case where you need distance, not only position. + +## 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.pt (plus the depth method used in the script)` +- 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 08_depth_estimation.py +``` + +Check the camera is visible before running: + +``` +ls /dev/video* +``` + +## How It Works + +1. Load the YOLO26n detection model (and the depth method used in the script). +2. Open the camera feed. +3. Detect objects in each frame. +4. Estimate the distance for each object (from a depth model or from camera geometry and object size). +5. Draw boxes with distance labels, plus 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 +- CONF_THRESHOLD / IOU_THRESHOLD : detection thresholds +- Camera calibration values (focal length, known object size) if geometry is used +- MODEL_WEIGHTS and depth model path + +## Controls + +- Press `Q` to quit the live window + +## Verify the Output + +Run `python3 08_depth_estimation.py` and confirm: + +- [ ] Each detected object shows a distance label. +- [ ] Distance increases as you move the object away and decreases as it comes closer. +- [ ] Compare a few readings with a measuring tape to check accuracy; 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.pt format=engine half=True +``` + +Then set `MODEL_WEIGHTS = 'yolo26n.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 + +Adds distance information on top of detection. + +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 + +- [Distance calculation guide](https://docs.ultralytics.com/guides/distance-calculation/) +- [Depth Anything V2](https://github.com/DepthAnything/Depth-Anything-V2) +- [Object detection task docs](https://docs.ultralytics.com/tasks/detect/) +- [Pinhole camera model (OpenCV)](https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html) +- [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