WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.98k stars 524 forks source link

Pickling error - _pickle.UnpicklingError: invalid load key, '<'. #269

Open Soumyajit83 opened 1 year ago

Soumyajit83 commented 1 year ago

/content/yolor Using torch 1.7.0 CUDA:0 (Tesla T4, 15109MB)

Namespace(adam=False, batch_size=2, bucket='', cache_images=False, cfg='/content/yolor/cfg/yolor_p6.cfg', data='/content/yolor/yolor.yaml', device='0', epochs=80, evolve=False, exist_ok=False, global_rank=-1, hyp='/content/yolor/data/hyp.scratch.1280.yaml', image_weights=False, img_size=[416, 416], local_rank=-1, log_imgs=16, multi_scale=False, name='yolor_p6', noautoanchor=False, nosave=False, notest=False, project='runs/train', rect=False, resume=False, save_dir='runs/train/yolor_p64', single_cls=False, sync_bn=False, total_batch_size=2, weights='/content/yolor/yolor_p6.pt', workers=8, world_size=1) Start Tensorboard with "tensorboard --logdir runs/train", view at http://localhost:6006/ NumExpr defaulting to 2 threads. Hyperparameters {'lr0': 0.01, 'lrf': 0.2, 'momentum': 0.937, 'weight_decay': 0.0005, 'warmup_epochs': 3.0, 'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1, 'box': 0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.5, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.0, 'fliplr': 0.5, 'mosaic': 1.0, 'mixup': 0.0} Traceback (most recent call last): File "train.py", line 537, in train(hyp, opt, device, tb_writer, wandb) File "train.py", line 80, in train ckpt = torch.load(weights, map_location=device) # load checkpoint File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 595, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 764, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, '<'.

How do I solve this pickling error?

stevenjayfrank commented 1 year ago

There seem to be two ways to solve this problem. First, try deleting the cache files in test, train, validate image/label folders. If that doesn't work, there may be a problem with your weights file; try re-downloading it.

MehmetZahidGenc commented 1 year ago

This error occur because of pretrained model. When pretrained model cannot be download while running thic code block !bash scripts/get_pretrain.sh

download the models manuelly

yolor_p6.pt: https://drive.google.com/uc?export=download&id=1Tdn3yqpZ79X7R1Ql0zNlNScB1Dv9Fp76 yolor_w6.pt: https://drive.google.com/uc?export=download&id=1UflcHlN5ERPdhahMivQYCbWWw7d2wY7U

then upload the which you want, then use it

ZBC043 commented 1 year ago

@MehmetZahidGenc Hi, for some reason I cannot open these two links, can you give me some help?

MehmetZahidGenc commented 1 year ago

@ZBC043 Hello, unfortunately we cannot access the weights. Maybe you can find anywhere. If you want to train a object detection model, can visit my github page; Computer-Vision-Resources