Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine Segmentation and Detection model (Yolov7 & Yolov8) #12643

Open
1 task done
FazanAfzal opened this issue May 13, 2024 · 2 comments
Open
1 task done

Combine Segmentation and Detection model (Yolov7 & Yolov8) #12643

FazanAfzal opened this issue May 13, 2024 · 2 comments
Labels
question Further information is requested

Comments

@FazanAfzal
Copy link

Search before asking

Question

I have trained multiple models. One model is a segmentation model, which is YOLOv7. The other is a detection model, which is YOLOv8. I want to combine these two models. Is it possible? Does YOLOv8 have any features related to this?

Additional

No response

@FazanAfzal FazanAfzal added the question Further information is requested label May 13, 2024
Copy link

👋 Hello @FazanAfzal, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

@FazanAfzal hello! Combining a YOLOv7 segmentation model with a YOLOv8 detection model directly within the same framework is not supported out-of-the-box. Each version of YOLO (v7 and v8) operates independently with its own architectural design and functionalities.

However, you can integrate the outputs of both models in your application logic. Simply run each model separately on your input data, then merge or analyze their outputs according to your requirements. Here is a very basic Python example to illustrate how you might approach this:

from ultralytics import YOLO

# Load your trained models
model_v7 = YOLO('path/to/yolov7_segmentation_model.pt')
model_v8 = YOLO('path/to/yolov8_detection_model.pt')

# Process the same image with both models
img = 'path/to/image.jpg'
segmentation_results = model_v7(img)
detection_results = model_v8(img)

# Now, you can combine the results from segmentation_results and detection_results as needed

Remember, the actual integration and usage might depend on what exactly you need from these combined results. This approach allows using the specific strengths of both models while maintaining flexibility in processing and outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants