Fix YOLOv8 accuracy

This commit is contained in:
Marcos Luciano
2023-02-09 00:41:35 -03:00
parent 940d244ad4
commit 2d6b92eb64
9 changed files with 43 additions and 10 deletions

View File

@@ -291,6 +291,11 @@ device = select_device('cpu')
model = torch.load(pt_file, map_location=device)['model'].float()
model.to(device).eval()
if model.names and model.nc:
with open("labels.txt", 'w') as fw:
for i in range(model.nc):
fw.write(model.names[i] + '\n')
with open(wts_file, 'w') as fw, open(cfg_file, 'w') as fc:
layers = Layers(len(model.model), inference_size, fw, fc)