WongKinYiu / ScaledYOLOv4

Scaled-YOLOv4: Scaling Cross Stage Partial Network
GNU General Public License v3.0
2.02k stars 575 forks source link

TypeError: zip argument #303 must support iteration #231

Open jigsawcoder opened 3 years ago

jigsawcoder commented 3 years ago

I was trying to train Scaled yolov4 p7 on a custom data set and I got this error.

Environment:

Jupyter Notebook Python version: 3.6.9 Pytorch version: 1.8.1+cu101 GPU: Nvidia RTX 2060 Super + Nvidia RTX 2070 Super

data.yaml :

train and val datasets (image directory or *.txt file with image paths) (The dir contains both images and labels)

train: /home/layout_scaled_yolo_v4/train val: /home/layout_scaled_yolo_v4/valid

test: ../coco/testdev2017.txt # 20k images for submission to https://competitions.codalab.org/competitions/20794

number of classes

nc: 8

class names

names: ['header', 'title', 'text', 'form', 'footer', 'list', 'table', 'figure']

config file used:

yolov4-p7.yaml

training Code:

%run train.py --batch 4 --epochs 101 --data './data/data.yaml' --hyp './data/hyp.finetune.yaml' --cfg './models/yolov4-p7.yaml' --weights '/home/layout_scaled_yolo_v4/yolov4-p7.pt' --name layout_dockbank_yolo --cache

Error Taceback :

TypeError Traceback (most recent call last) /home/layout_scaled_yolo_v4/ScaledYOLOv4/train.py in 441 tb_writer = SummaryWriter(log_dir=increment_dir(Path(opt.logdir) / 'exp', opt.name)) # runs/exp 442 --> 443 train(hyp, opt, device, tb_writer) 444 445 # Evolve hyperparameters (optional)

/home/layout_scaled_yolo_v4/ScaledYOLOv4/train.py in train(hyp, opt, device, tb_writer) 159 # local_rank is set to -1. Because only the first process is expected to do evaluation. 160 testloader = create_dataloader(test_path, imgsz_test, batch_size, gs, opt, hyp=hyp, augment=False, --> 161 cache=opt.cache_images, rect=True, local_rank=-1, world_size=opt.world_size)[0] 162 163 # Model parameters

/home/layout_scaled_yolo_v4/ScaledYOLOv4/utils/datasets.py in create_dataloader(path, imgsz, batch_size, stride, opt, hyp, augment, cache, pad, rect, local_rank, world_size) 58 single_cls=opt.single_cls, 59 stride=int(stride), ---> 60 pad=pad) 61 62 batch_size = min(batch_size, len(dataset))

/home/layout_scaled_yolo_v4/ScaledYOLOv4/utils/datasets.py in init(self, path, img_size, batch_size, augment, hyp, rect, image_weights, cache_images, single_cls, stride, pad) 342 343 # Get labels --> 344 labels, shapes = zip(*[cache[x] for x in self.img_files]) 345 self.shapes = np.array(shapes, dtype=np.float64) 346 self.labels = list(labels)

TypeError: zip argument #303 must support iteration

Please Help Thanks in Advance!!

mechaadi commented 2 years ago

Hi, were you able to solve this problem?