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

W&B logging error of test.py occurs during training. #254

Open cslee99 opened 2 years ago

cslee99 commented 2 years ago

An error occurs while learning. Please help. To train with custome data, a data.yaml file was created. Contents included are as follows.

data.yaml train: E:/Dev/AI/yolor/data/roboflow/train/images val: E:/Dev/AI/yolor/data/roboflow/valid/images test: E:/Dev/AI/yolor/data/roboflow/test/images

nc: 1 names: ['Stone']

Train was driven by the script below. train Script python train.py --batch-size 8 --img 416 416 --data data/data.yaml --cfg cfg/yolor_p6.cfg --weights './yolor_p6.pt' --device 0 --name yolor_p6 --names data/data.names --hyp hyp.scratch.1280.yaml --epochs 50

An error occurs at line 164 of test.py.

Traceback (most recent call last): File "E:\Dev\AI\yolor\train.py", line 537, in train(hyp, opt, device, tb_writer, wandb) File "E:\Dev\AI\yolor\train.py", line 336, in train results, maps, times = test.test(opt.data, File "E:\Dev\AI\yolor\test.py", line 164, in test box_data = [{"position": {"minX": xyxy[0], "minY": xyxy[1], "maxX": xyxy[2], "maxY": xyxy[3]}, File "E:\Dev\AI\yolor\test.py", line 166, in "box_caption": "%s %.3f" % (names[cls], conf), TypeError: list indices must be integers or slices, not float

The value of the cls variable is displayed as a float. (0.0, 23.0) Shouldn't it be changed in the code above? change code : name[cls] ==> name[int(cls)]

Also, I have nc:1 and num of classes is 1, so why does it come out with values of 23.0 and 31.0?

First, to see that it works perfectly, I changed the code to names[0] and proceeded. However, at line 170 of test.py, the following error occurs.

wandb_images 'list' object has no attribute 'items'