-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: 'float' object cannot be interpreted as an integer #1051
Comments
@Ringhu we recently changed this code to replace
|
Thanks for ur reply. I fugure it out. It's because the variable |
@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. |
Thanks! It is solved now. |
@anisaha1 great! |
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
File "train.py", line 235, in train
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
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?
The text was updated successfully, but these errors were encountered: