File “train.py”, line 666, in
main(opt)
File “train.py”, line 557, in main
train(opt.hyp, opt, device, callbacks)
File “train.py”, line 349, in train
logger.log_images(files, ‘Mosaics’, epoch)
File “/root/autodl-tmp/yolov5-master/utils/loggers/init.py”, line 360, in log_images
self.tb.add_image(f.stem, cv2.imread(str(f))[…, ::-1], epoch, dataformats=‘HWC’)
File “/root/miniconda3/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py”, line 549, in add_image
image(tag, img_tensor, dataformats=dataformats), global_step, walltime)
File “/root/miniconda3/lib/python3.8/site-packages/torch/utils/tensorboard/summary.py”, line 396, in image
image = make_image(tensor, rescale=rescale)
File “/root/miniconda3/lib/python3.8/site-packages/torch/utils/tensorboard/summary.py”, line 438, in make_image
image = image.resize((scaled_width, scaled_height), Image.ANTIALIAS)
AttributeError: module ‘PIL.Image’ has no attribute ‘ANTIALIAS’
原因是pillow版本有问题,默认是10.1.0
解决办法:pip install pillow==9.5.0