CHANGING NAME OF PREDICTED LABEL ON PREDICTED IMAGE #2254
Unanswered
edanurkamaci
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You can change the name using the code below. import torch
from ultralytics import YOLO
model = YOLO('yolov8n.pt')
print('Before: ')
print(model.model.names)
print()
indices = list(model.model.names.values())
# Change name here
## model.model.names[indices.index(BEFORE)] = AFTER
model.model.names[indices.index('person')] = 'human'
print('After: ')
print(model.model.names)
ckpt = {
'epoch': model.ckpt['epoch'],
'best_fitness': model.ckpt['best_fitness'],
'model': model.ckpt['model'],
'ema': model.ckpt['ema'],
'updates': model.ckpt['updates'],
'optimizer': model.ckpt['optimizer'],
'train_args': model.ckpt['train_args'],
'date': model.ckpt['date'],
'version': model.ckpt['version']}
torch.save(ckpt, 'rename.pt') Result |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello i have an urgent question. I do not have time to train a model again so i wanted to change the name of labels after test result, but i want new labels on predicted result image. How can i do that?
Beta Was this translation helpful? Give feedback.
All reactions