BiSeNet icon indicating copy to clipboard operation
BiSeNet copied to clipboard

Costum Dataset: 2 Lables

Open farmbert opened this issue 4 years ago • 14 comments
trafficstars

I want to train my own data. The images have two lables 0 (Plant) and 1(Rest). I've generated an annotation file and adapted the im_root and train/val_im_anns in the configuration files, as specified in README.md but it is not working (cityscapes works).

Can anyone help me? If necessary I can give you more infos.

farmbert avatar Feb 08 '21 15:02 farmbert

Then please patch the details how you modified the code, and what is the error message is like.

CoinCheung avatar Feb 09 '21 03:02 CoinCheung

Until now I modified:

bisenetv2.py: im_root='./datasets/thistle', train_im_anns='./datasets/thistle/train.txt', val_im_anns='./datasets/thistle/val.txt',

train and val.txt: /home/user/Downloads/BiSeNet-master/datasets/thistle/images/train/DJI_0077.png,/home/user/Downloads/BiSeNet-master/datasets/thistle/annotations/train/DJI_0077a.png ...

and the error message is: /usr/bin/python3.8 /home/user/Downloads/BiSeNet-master/tools/train_amp.py --local_rank 0 --model bisenetv2 Reducer buckets have been rebuilt in this iteration. iter: 100/200, lr: 0.028313, eta: 0:00:39, time: 39.80, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan iter: 200/200, lr: 0.000445, eta: 0:00:00, time: 39.14, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan

save models to ./res/model_final.pth

evaluating the final model 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 206, in main() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 202, in main train() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 186, in train heads, mious = eval_model(net, 2, cfg.im_root, cfg.val_im_anns) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 197, in eval_model mIOU = single_scale(net, dl, 19) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 43, in call for i, (imgs, label) in diter: File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1166, in iter for obj in iterable: File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.8/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "./lib/base_dataset.py", line 43, in getitem img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0) TypeError: 'NoneType' object is not subscriptable

Process finished with exit code 1

farmbert avatar Feb 15 '21 13:02 farmbert

Seeing this:

File "./lib/base_dataset.py", line 43, in getitem
img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0)
TypeError: 'NoneType' object is not subscriptable

I feel maybe you have not configured dataset well. Besides, you might also have not change num_classes according to your dataset.

CoinCheung avatar Mar 04 '21 05:03 CoinCheung

Thanks! After fixing the dataset it is running and I am getting the first results.

The only problem left is that I don't get information when evaluating my model. Do you have a solution for that too?

INFO evaluate.py(238): setup and restore model
INFO evaluate.py(200): single mIOU is: nan

INFO evaluate.py(212): single scale crop mIOU is: nan

INFO evaluate.py(218): ms flip mIOU is: nan

INFO evaluate.py(230): ms crop mIOU is: nan

INFO evaluate.py(255): |   single_scale |   single_scale_crop |   ms_flip |   ms_flip_crop |
|----------------+---------------------+-----------+----------------|
|            nan |                 nan |       nan |            nan |

farmbert avatar Mar 08 '21 09:03 farmbert

Thanks! After fixing the dataset it is running and I am getting the first results.

The only problem left is that I don't get information when evaluating my model. Do you have a solution for that too?

INFO evaluate.py(238): setup and restore model
INFO evaluate.py(200): single mIOU is: nan

INFO evaluate.py(212): single scale crop mIOU is: nan

INFO evaluate.py(218): ms flip mIOU is: nan

INFO evaluate.py(230): ms crop mIOU is: nan

INFO evaluate.py(255): |   single_scale |   single_scale_crop |   ms_flip |   ms_flip_crop |
|----------------+---------------------+-----------+----------------|
|            nan |                 nan |       nan |            nan |

hi, did you solve this problem?

Linda-L avatar Apr 13 '21 12:04 Linda-L

Thanks! After fixing the dataset it is running and I am getting the first results.

The only problem left is that I don't get information when evaluating my model. Do you have a solution for that too?

INFO evaluate.py(238): setup and restore model

INFO evaluate.py(200): single mIOU is: nan

INFO evaluate.py(212): single scale crop mIOU is: nan

INFO evaluate.py(218): ms flip mIOU is: nan

INFO evaluate.py(230): ms crop mIOU is: nan

INFO evaluate.py(255): | single_scale | single_scale_crop | ms_flip | ms_flip_crop |

|----------------+---------------------+-----------+----------------|

| nan | nan | nan | nan |

hi, did you solve this problem?

Hi,

Yes I changed the number of classes in evaluation.py to 3 instead of 2. I don't know if it is the right solution but it works. Maybe because the ignore label counts extra???

farmbert avatar Apr 16 '21 05:04 farmbert

Thanks! After fixing the dataset it is running and I am getting the first results.

The only problem left is that I don't get information when evaluating my model. Do you have a solution for that too?

INFO evaluate.py(238): setup and restore model

INFO evaluate.py(200): single mIOU is: nan

INFO evaluate.py(212): single scale crop mIOU is: nan

INFO evaluate.py(218): ms flip mIOU is: nan

INFO evaluate.py(230): ms crop mIOU is: nan

INFO evaluate.py(255): | single_scale | single_scale_crop | ms_flip | ms_flip_crop |

|----------------+---------------------+-----------+----------------|

| nan | nan | nan | nan |

hi, did you solve this problem?

Hi,

Yes I changed the number of classes in evaluation.py to 3 instead of 2. I don't know if it is the right solution but it works. Maybe because the ignore label counts extra???

Hello, what have you changed in addition to the above? Could you please tell me in detail?Or is it convenient for email communication? My email address is [email protected]

ggohem avatar Apr 25 '21 12:04 ggohem

Until now I modified:

bisenetv2.py: im_root='./datasets/thistle', train_im_anns='./datasets/thistle/train.txt', val_im_anns='./datasets/thistle/val.txt',

train and val.txt: /home/user/Downloads/BiSeNet-master/datasets/thistle/images/train/DJI_0077.png,/home/user/Downloads/BiSeNet-master/datasets/thistle/annotations/train/DJI_0077a.png ...

and the error message is: /usr/bin/python3.8 /home/user/Downloads/BiSeNet-master/tools/train_amp.py --local_rank 0 --model bisenetv2 Reducer buckets have been rebuilt in this iteration. iter: 100/200, lr: 0.028313, eta: 0:00:39, time: 39.80, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan iter: 200/200, lr: 0.000445, eta: 0:00:00, time: 39.14, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan

save models to ./res/model_final.pth

evaluating the final model 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 206, in main() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 202, in main train() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 186, in train heads, mious = eval_model(net, 2, cfg.im_root, cfg.val_im_anns) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 197, in eval_model mIOU = single_scale(net, dl, 19) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 43, in call for i, (imgs, label) in diter: File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1166, in iter for obj in iterable: File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.8/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "./lib/base_dataset.py", line 43, in getitem img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0) TypeError: 'NoneType' object is not subscriptable

Process finished with exit code 1

@farmbert ,I have the same problem.Could you tell me what else you have changed,please.thank you!

yanzhou-li avatar Apr 26 '21 08:04 yanzhou-li

Thanks! After fixing the dataset it is running and I am getting the first results.

The only problem left is that I don't get information when evaluating my model. Do you have a solution for that too?

INFO evaluate.py(238): setup and restore model

INFO evaluate.py(200): single mIOU is: nan

INFO evaluate.py(212): single scale crop mIOU is: nan

INFO evaluate.py(218): ms flip mIOU is: nan

INFO evaluate.py(230): ms crop mIOU is: nan

INFO evaluate.py(255): | single_scale | single_scale_crop | ms_flip | ms_flip_crop |

|----------------+---------------------+-----------+----------------|

| nan | nan | nan | nan |

hi, did you solve this problem?

Hi, Yes I changed the number of classes in evaluation.py to 3 instead of 2. I don't know if it is the right solution but it works. Maybe because the ignore label counts extra???

Hello, what have you changed in addition to the above? Could you please tell me in detail?Or is it convenient for email communication? My email address is [email protected]

Nothing only the number of classes...

farmbert avatar Apr 26 '21 08:04 farmbert

Until now I modified: bisenetv2.py: im_root='./datasets/thistle', train_im_anns='./datasets/thistle/train.txt', val_im_anns='./datasets/thistle/val.txt', train and val.txt: /home/user/Downloads/BiSeNet-master/datasets/thistle/images/train/DJI_0077.png,/home/user/Downloads/BiSeNet-master/datasets/thistle/annotations/train/DJI_0077a.png ... and the error message is: /usr/bin/python3.8 /home/user/Downloads/BiSeNet-master/tools/train_amp.py --local_rank 0 --model bisenetv2 Reducer buckets have been rebuilt in this iteration. iter: 100/200, lr: 0.028313, eta: 0:00:39, time: 39.80, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan iter: 200/200, lr: 0.000445, eta: 0:00:00, time: 39.14, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan save models to ./res/model_final.pth evaluating the final model 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 206, in main() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 202, in main train() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 186, in train heads, mious = eval_model(net, 2, cfg.im_root, cfg.val_im_anns) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 197, in eval_model mIOU = single_scale(net, dl, 19) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 43, in call for i, (imgs, label) in diter: File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1166, in iter for obj in iterable: File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.8/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "./lib/base_dataset.py", line 43, in getitem img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0) TypeError: 'NoneType' object is not subscriptable Process finished with exit code 1

@farmbert ,I have the same problem.Could you tell me what else you have changed,please.thank you!

There was a faulty annotated image in my Dataset. I located the picture by debugging and simply deleted it.

farmbert avatar Apr 26 '21 08:04 farmbert

Thx,my problem have been solved!

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年4月26日(星期一) 下午4:12 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [CoinCheung/BiSeNet] Costum Dataset: 2 Lables (#131)

Until now I modified: bisenetv2.py: im_root='./datasets/thistle', train_im_anns='./datasets/thistle/train.txt', val_im_anns='./datasets/thistle/val.txt', train and val.txt: /home/user/Downloads/BiSeNet-master/datasets/thistle/images/train/DJI_0077.png,/home/user/Downloads/BiSeNet-master/datasets/thistle/annotations/train/DJI_0077a.png ... and the error message is: /usr/bin/python3.8 /home/user/Downloads/BiSeNet-master/tools/train_amp.py --local_rank 0 --model bisenetv2 Reducer buckets have been rebuilt in this iteration. iter: 100/200, lr: 0.028313, eta: 0:00:39, time: 39.80, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan iter: 200/200, lr: 0.000445, eta: 0:00:00, time: 39.14, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan save models to ./res/model_final.pth evaluating the final model 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 206, in main() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 202, in main train() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 186, in train heads, mious = eval_model(net, 2, cfg.im_root, cfg.val_im_anns) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 197, in eval_model mIOU = single_scale(net, dl, 19) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 43, in call for i, (imgs, label) in diter: File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1166, in iter for obj in iterable: File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.8/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "./lib/base_dataset.py", line 43, in getitem img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0) TypeError: 'NoneType' object is not subscriptable Process finished with exit code 1

@farmbert ,I have the same problem.Could you tell me what else you have changed,please.thank you!

There was a faulty annotated image in my Dataset. I located the picture by debugging and simply deleted it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

ggohem avatar Apr 26 '21 08:04 ggohem

Until now I modified: bisenetv2.py: im_root='./datasets/thistle', train_im_anns='./datasets/thistle/train.txt', val_im_anns='./datasets/thistle/val.txt', train and val.txt: /home/user/Downloads/BiSeNet-master/datasets/thistle/images/train/DJI_0077.png,/home/user/Downloads/BiSeNet-master/datasets/thistle/annotations/train/DJI_0077a.png ... and the error message is: /usr/bin/python3.8 /home/user/Downloads/BiSeNet-master/tools/train_amp.py --local_rank 0 --model bisenetv2 Reducer buckets have been rebuilt in this iteration. iter: 100/200, lr: 0.028313, eta: 0:00:39, time: 39.80, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan iter: 200/200, lr: 0.000445, eta: 0:00:00, time: 39.14, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan save models to ./res/model_final.pth evaluating the final model 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 206, in main() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 202, in main train() File "/home/user/Downloads/BiSeNet-master/tools/train_amp.py", line 186, in train heads, mious = eval_model(net, 2, cfg.im_root, cfg.val_im_anns) File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 197, in eval_model mIOU = single_scale(net, dl, 19) File "/home/user/Downloads/BiSeNet-master/tools/evaluate.py", line 43, in call for i, (imgs, label) in diter: File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1166, in iter for obj in iterable: File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.8/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "./lib/base_dataset.py", line 43, in getitem img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0) TypeError: 'NoneType' object is not subscriptable Process finished with exit code 1

@farmbert ,I have the same problem.Could you tell me what else you have changed,please.thank you!

There was a faulty annotated image in my Dataset. I located the picture by debugging and simply deleted it. @farmbert ,Oh,by the way,do you use the lb_map and labels_info?Could you show me your label images?If it's convenient, can we add QQ?My QQ number is 962222937.Looking forward to your reply!

yanzhou-li avatar Apr 26 '21 08:04 yanzhou-li

Thanks! After fixing the dataset it is running and I am getting the first results. The only problem left is that I don't get information when evaluating my model. Do you have a solution for that too?

INFO evaluate.py(238): setup and restore model
INFO evaluate.py(200): single mIOU is: nan

INFO evaluate.py(212): single scale crop mIOU is: nan

INFO evaluate.py(218): ms flip mIOU is: nan

INFO evaluate.py(230): ms crop mIOU is: nan

INFO evaluate.py(255): |   single_scale |   single_scale_crop |   ms_flip |   ms_flip_crop |
|----------------+---------------------+-----------+----------------|
|            nan |                 nan |       nan |            nan |

hi, did you solve this problem?

hi, did you solve this problem? I met the same problem, how did you solve it?

WangzekunY avatar Jul 14 '21 07:07 WangzekunY

I have adjusted my dataset to the format of cityscapes, but errors are always reported when running train.py and evaluate.py. I want to divide my defect dataset into two colors. The defect part is white and the background part is black, so I modified cityscapes_ cv2.py, as follows: labels_info = [ {"hasInstances": True, "category": "object", "catid": 0, "name": "backforward", "ignoreInEval": False, "id": 0, "color": [0, 0, 0], "trainId": 0}, {"hasInstances": True, "category": "object", "catid": 0, "name": "defect", "ignoreInEval": False, "id": 1, "color": [255, 255, 255], "trainId": 1}, {"hasInstances": False, "category": "vehicle", "catid": 7, "name": "license plate", "ignoreInEval": True, "id": -1, "color": [0, 0, 142], "trainId": -1}] And I'm in train.py and evaluate.py, cityscapes_ cv2.py has modified the number of categories to 2, but I haven't modified others .The following error occurred when I ran evaluate. py:

setup and restore model 0%| | 0/1018 [00:00<?, ?it/s]Traceback (most recent call last): File "/home/caiweixin/Downloads/BiSeNet-master (4)/BiSeNet-master/tools/evaluate.py", line 294, in main() File "/home/caiweixin/Downloads/BiSeNet-master (4)/BiSeNet-master/tools/evaluate.py", line 290, in main evaluate(cfg, args.weight_pth) File "/home/caiweixin/Downloads/BiSeNet-master (4)/BiSeNet-master/tools/evaluate.py", line 262, in evaluate heads, mious = eval_model(cfg, net) File "/home/caiweixin/anaconda3/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/caiweixin/Downloads/BiSeNet-master (4)/BiSeNet-master/tools/evaluate.py", line 204, in eval_model mIOU = single_scale(net, dl, cfg.n_cats) File "/home/caiweixin/Downloads/BiSeNet-master (4)/BiSeNet-master/tools/evaluate.py", line 72, in call hist += torch.bincount( RuntimeError: shape '[2, 2]' is invalid for input of size 509 0%| | 0/1018 [00:02<?, ?it/s]

What should I do? thank you

到现在我修改了: bisenetv2.py: im_root='./datasets/ thistle ', train_im_anns='./datasets/thistle/train.txt', val_im_anns='./datasets/thistle/val.txt', train and val .txt: /home/user/Downloads/BiSeNet-master/datasets/thistle/images/train/DJI_0077.png,/home/user/Downloads/BiSeNet-master/datasets/thistle/annotations/train/DJI_0077a.png .. . 并且错误信息是: /usr/bin/python3.8 /home/user/Downloads/BiSeNet-master/tools/train_amp.py --local_rank 0 --model bisenetv2 Reducer buckets has been rebuilt in this session . iter: 100/200, lr: 0.028313, eta: 0:00:39, time: 39.80, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan iter: 200/200, lr: 0.000445, eta: 0:00:00, time: 39.14, loss: nan, loss_pre: nan, loss_aux0: nan, loss_aux1: nan, loss_aux2: nan, loss_aux3: nan 将模型保存到./ res/model_final.pth 评估最终模型 0%| | 0/1 [00:00<?, ?it/s] 回溯(最近一次调用最后一次): 文件“/home/user/Downloads/BiSeNet-master/tools/train_amp.py”,第 206 行,在 main() 文件“/home/user/Downloads/BiSeNet-master/tools/train_amp.py”,第 202 行,主 train() 文件“/home/user/Downloads/BiSeNet-master/tools/train_amp.py”,第 186 行, 在 火车头中,mious = eval_model(net, 2, cfg.im_root, cfg.val_im_anns) 文件“/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py”,第 26 行, 返回 func(*args, **kwargs) 文件“/home/user/Downloads/BiSeNet-master/tools/evaluate.py”,第 197 行,在 eval_model mIOU = single_scale(net, dl, 19) 文件“/home/ user/Downloads/BiSeNet-master/tools/evaluate.py", line 43, in call for i, (imgs, label) in diter: File "/usr/local/lib/python3.8/dist-packages/tqdm/ std.py", line 1166, in iter for obj in iterable: File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() 文件“/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py”,第 1085 行,在 _next_data 中 return self._process_data(data) 文件“/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py”,第 1111 行,在 _process_data data.reraise() 文件“/usr/local/lib/python3.8 /dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (last last call last): File "/usr/local/ lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.8/dist -packages/torch/utils/data/_utils/fetch.py​​",第 44 行,在 fetch data = [self.dataset[idx] for idx in possible_batched_index ] 文件“/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py​​”,第 44 行, 数据 = [self.dataset[idx] for idx in possible_batched_index] 文件“ ./lib/base_dataset.py", line 43, in getitem img, label = cv2.imread(impth)[:, :, ::-1], cv2.imread(lbpth, 0) TypeError: 'NoneType' object is不可下标 进程以退出代码 1 结束

@farmbert,我也有同样的问题。能告诉我你还改了什么吗,谢谢!

我的数据集中有一个错误的注释图像。我通过调试找到了图片并简单地将其删除。

202041600047 avatar Jul 23 '21 04:07 202041600047

Likely this problem is solved, so let me close this.

CoinCheung avatar Nov 15 '22 03:11 CoinCheung

你好,李yanzhou已经收到你的邮件,谢谢!

yanzhou-li avatar Nov 15 '22 03:11 yanzhou-li