2023-04-22

How can I assemble 2 or more ".pt" files with PyTorch?

I've tried to label all the Images and train the model but, when I tried it, it gave the same class as result in various class. I have the ".pt" files separately also. Is there a way to assemble all ".pt" files in a single ".pt" file ?

I've taken some code examples from Chat GPT but, I didn't take what I expected. What I expect is to use 5 ".pt" file in a single PyTorch file. My files are "bir.pt, iki.pt, uc.pt, dort.pt, bes.pt" and I want to assemble them in a single "final.pt" file. After making this, I want to make the code I gave running.

from ultralytics import YOLO
model= YOLO("nihai.pt")
for detection in model(0):
    class_id = detection[5]
    confidence = detection[4]
    if confidence > threshold:
        if class_id == 0:
            bes_detected = True
        if class_id == 1:
            bir_detected = True
        elif class_id == 2:
            dort_detected = True
        elif class_id == 3:
            iki_detected = True
        elif class_id == 4:
            uc_detected = True


No comments:

Post a Comment