Open EMEliasMi8859 opened 1 month ago
👋 Hello @EMEliasMi8859, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more:
If this is a 🐛 Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.
If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.
We try to respond to all issues as promptly as possible. Thank you for your patience!
What is the best retrained model for feature extraction no one is working with different point of view on the second camera
On Tue, Jul 23, 2024, 1:41 PM Paula Derrenger @.***> wrote:
@EMEliasMi8859 https://github.com/EMEliasMi8859 hello!
Thank you for your question and for searching the HUB issues beforehand 😊.
To achieve object re-identification or co-detection across multiple cameras, you can follow these steps:
1.
Object Detection: Use YOLOv5 or YOLOv8 to detect objects in each camera feed. Ensure you are using the latest version of the Ultralytics YOLO models for the best performance and features. 2.
Object Tracking: Implement an object tracking algorithm to assign unique IDs to detected objects in the first camera feed. You can use trackers like Deep SORT, which integrates well with YOLO models. 3.
Feature Extraction: Extract features of the detected objects (e.g., appearance features using a pre-trained CNN) to create a feature vector for each object. 4.
Re-identification: When an object is detected in the second camera, compare its feature vector with the feature vectors of objects from the first camera. You can use metrics like cosine similarity or Euclidean distance to match objects and transfer the ID from the first camera to the second.
Here is a basic outline of the code to get you started:
import torchfrom deep_sort_realtime.deepsort_tracker import DeepSort
Load YOLO modelmodel = torch.hub.load('ultralytics/yolov5', 'yolov5s')
Initialize Deep SORTtracker = DeepSort(max_age=30, n_init=3, nms_max_overlap=1.0, max_cosine_distance=0.2)
Process frames from Camera 1for frame in camera1_frames:
results = model(frame) detections = results.xyxy[0].cpu().numpy() tracks = tracker.update_tracks(detections, frame=frame) for track in tracks: if not track.is_confirmed(): continue track_id = track.track_id bbox = track.to_tlbr() # Extract and save features for re-identification # feature_vector = extract_features(frame, bbox)
Process frames from Camera 2for frame in camera2_frames:
results = model(frame) detections = results.xyxy[0].cpu().numpy() tracks = tracker.update_tracks(detections, frame=frame) for track in tracks: if not track.is_confirmed(): continue track_id = track.track_id bbox = track.to_tlbr() # Extract features and match with Camera 1 # feature_vector = extract_features(frame, bbox) # match_id = match_with_camera1(feature_vector) # Assign matched ID # track.track_id = match_id
This is a simplified example, and you may need to adapt it to your specific use case. For more advanced re-identification, consider using specialized re-identification models.
I hope this helps! If you have any further questions, feel free to ask.
— Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/775#issuecomment-2244674833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVU5GALTTV3NJB3FTNKNWU3ZNYM4JAVCNFSM6AAAAABLJT2IJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGY3TIOBTGM . You are receiving this because you were mentioned.Message ID: @.***>
@pderrenger thank you very much ms pderrenger for your effort you take to answer:
i have already implemented deep sort and yolov10 tracking algorithms in single camera they are better in real time performance and accuracy but feature extractions on the second camera where in most cases the object is from different point of view different lighting scale and rotation the feature extraction and Euclidean distance are not giving that much performance in real time applications >>> so ??? this is the problem i am facing
Search before asking
Description
i want to track an object of the coco dataset in multiple cameras how to do so in second camera to pass the id from the first camera by detecting the specific object in the second camera
Use case
No response
Additional
No response