WongKinYiu / yolov9

Implementation of paper - YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information
GNU General Public License v3.0
8.8k stars 1.36k forks source link

Yolov9 + SAM ( Meta ) #103

Open Redouxne opened 6 months ago

Redouxne commented 6 months ago

Hi,

I want to get the bboxes frome Yolov9 with this code which works with Yolov8.

Here is thee code that I use for Yolov8:

from ultralytics import YOLO

model = YOLO('yolov8n.pt')

results = model.predict(source='PATH_TO_IMAGE', conf=0.25)

for result in results:
    boxes = result.xyxy
bbox=boxes.xyxy.tolist()[0]

How can I get the results witth Yolov9 in a way that allow me to implement it with SAM later ?

deepukr007 commented 6 months ago

Ultralytics have not included yolov9 yet..

Youho99 commented 6 months ago

You have to check with ultralytics directly They plan to implement a yolov9 model if I don't say something stupid https://docs.ultralytics.com/fr/models/yolov9/#integration-and-future-directions

Redouxne commented 6 months ago

Ultralytics have not included yolov9 yet..

What I wanted was to take the Yolov8 code that I cited and reproduce the box recovery functionality but on Yolov9 and without going through the

from ultralytics import YOLO

model = YOLO('yolov8n.pt')

results = model.predict(source='PATH_TO_IMAGE', conf=0.25)

But adapting this code to the V9 version.

Thanks

deepinvalue commented 6 months ago

@Redouxne Check out my notebook at deepinvalue/yolov9-supervision-tracking-counting. I believe it could be adapted to achieve what you're looking for.

sujanshresstha commented 6 months ago

Hi @Redouxne, Is this what you are referring to?

model = DetectMultiBackend(weights='path_to_weight', device=device, fuse=True)
results = AutoShape(model(path_to_image))
for det in results.pred[0]:
    bbox = det[:4]
    x1, y1, x2, y2 = map(int, bbox)

You can find more details and context on how to use it on YOLOv9_DeepSORT

theankeshh commented 6 months ago

Please don;t worry, I request you to please wait for 24-48 hours, and allow us time to look into it, we will surely get into the best possible resolution.

MuhammadBilal848 commented 6 months ago

@Redouxne Check out my notebook at deepinvalue/yolov9-supervision-tracking-counting. I believe it could be adapted to achieve what you're looking for.

It's not working for Live Inference. I think you would call the process_video function to do live inference as;

yolov9_config=dict(conf=0.3, iou=0.45, classes=[0, 2, 3])
process_video(model, config=yolov9_config, counting_zone=None, show_labels=True, source_path=1,
                    target_path='output/otpt_5.mp4')

The code starts running and completes within a second but does nothing. No screen shows up.

TheMattBin commented 4 months ago

are you trying to get the bounding box from the image to be predicted? I think comments from @sujanshresstha should be able to work.