Hi @glenn-jocher , I git clone ur latest version today. But when I run train.py like
python train.py --cfg=cfg/yolov3-tiny.cfg --multi-scale --device=1,2,3,5 --weights=
this, I got the error:
`
Traceback (most recent call last):
File "train.py", line 429, in
train() # train normally
File "train.py", line 235, in train
for i, (imgs, targets, paths, _) in pbar: # batch -------------------------------------------------------------
File "/home/hulining/.local/lib/python3.6/site-packages/tqdm/_tqdm.py", line 1032, in __iter__
for obj in iterable:
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in __next__
data = self._next_data()
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data
return self._process_data(data)
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data
data.reraise()
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise
raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/hulining/anaconda3/envs/pt/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/proj/hulining/home/download/yolov3/utils/datasets.py", line 420, in __getitem__
img, labels = load_mosaic(self, index)
File "/proj/hulining/home/download/yolov3/utils/datasets.py", line 543, in load_mosaic
img4 = np.full((s * 2, s * 2, img.shape[2]), 114, dtype=np.int8) # base image with 4 tiles
File "/home/hulining/.local/lib/python3.6/site-packages/numpy/core/numeric.py", line 325, in full
a = empty(shape, dtype, order)
TypeError: 'float' object cannot be interpreted as an integer
`
Could u solve it?
@Ringhu we recently changed this code to replace 3
with img.shape[2]
. You might try undoing the change to see if this solves the problem for you. We have not seen any issues like this.
img4 = np.full((s * 2, s * 2, img.shape[2]), 114, dtype=np.int8) # base image with 4 tiles
Thanks for ur reply. I fugure it out. It's because the variable s
become a float variable for some reason I don't know. When I change the type of s
(which is img_size) to int, the problem solved.
@glenn-jocher The issue is here.
If imgsz_min equals imgsz_max (let's say I pass [320, 320, 320]) and I also have --multi-scale, then the divisions imgsz_min //= 1.5 and imgsz_max //= 0.667 return floats which throws error in the mosaic function. Probably you have never used this combination of arguments. Casting it to int will solve the problem.
@anisaha1 thank you for the clear explanation! We've implemented a fix in d40595989388e0c99b7ee7e391b2ca9a7edb7848. Can you git pull and try again?
Thanks! It is solved now.
@anisaha1 great!
Most helpful comment
Thanks for ur reply. I fugure it out. It's because the variable
s
become a float variable for some reason I don't know. When I change the type ofs
(which is img_size) to int, the problem solved.