Train: Checking formats of images with 2 process(es):
0 image(s) corrupted: 100% 16551/16551 [00:04<00:00, 3492.70it/s]
Train: Checking formats of labels with 2 process(es):
16551 label(s) found, 0 label(s) missing, 0 label(s) empty, 0 invalid label files: 100% 16551/16551 [00:05<00:00, 3060.44it/s]
Train: Final numbers of valid images: 16551/ labels: 16551.
11.2s for dataset initialization.
Val: Checking formats of images with 2 process(es):
0 image(s) corrupted: 100% 4952/4952 [00:02<00:00, 2001.52it/s]
Val: Checking formats of labels with 2 process(es):
4952 label(s) found, 0 label(s) missing, 0 label(s) empty, 0 invalid label files: 100% 4952/4952 [00:03<00:00, 1368.68it/s]
Convert to COCO format
100% 4952/4952 [00:00<00:00, 33957.31it/s]
Convert to COCO format finished. Resutls saved in VOCdevkit/voc_07_12/annotations/instances_val.json
Val: Final numbers of valid images: 4952/ labels: 4952.
8.3s for dataset initialization.
Loading state_dict from weights/yolov6n.pt for fine-tuning...
Traceback (most recent call last):
File "/content/YOLOv6/tools/train.py", line 128, in <module>
main(args)
File "/content/YOLOv6/tools/train.py", line 113, in main
trainer = Trainer(args, cfg, device)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/YOLOv6/yolov6/core/engine.py", line 56, in init
model = self.get_model(args, cfg, self.num_classes, device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/YOLOv6/yolov6/core/engine.py", line 385, in get_model
model = load_state_dict(weights, model, map_location=device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/YOLOv6/yolov6/utils/checkpoint.py", line 13, in load_state_dict
ckpt = torch.load(weights, map_location=map_location)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/torch/serialization.py", line 1470, in load
raise pickle.UnpicklingError(get_wo_message(str(e))) from None
pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL yolov6.models.yolo.Model was not an allowed global by default. Please use `torch.serialization.add_safe_globals([Model])` or the `torch.serialization.safe_globals([Model])` context manager to allowlist this global if you trust this class/function.
Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.