PJLallen / OSFormer

Official Implementation of ECCV2022 paper "OSFormer: One-Stage Camouflaged Instance Segmentation with Transformers"
87 stars 20 forks source link

error: (-215:Assertion failed) !dsize.empty() in function 'resize' #10

Closed Singerone closed 1 year ago

Singerone commented 1 year ago

Traceback (most recent call last): File "/opt/conda/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/conda/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/root/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/root/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/root/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/root/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/root/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/root/.vscode-server/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/code/OSFormer/tools/train_net.py", line 195, in launch( File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/launch.py", line 82, in launch main_func(args) File "/code/OSFormer/tools/train_net.py", line 189, in main return trainer.train() File "/code/OSFormer/tools/train_net.py", line 67, in train self.train_loop(self.start_iter, self.max_iter) File "/code/OSFormer/tools/train_net.py", line 56, in train_loop self.run_step() File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 497, in run_step self._trainer.run_step() File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 273, in run_step loss_dict = self.model(data) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, *kwargs) File "/code/OSFormer/adet/modeling/osformer/osformer.py", line 158, in forward targets = self.get_ground_truth(gt_instances, mask_feat_size) File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(args, **kwargs) File "/code/OSFormer/adet/modeling/osformer/osformer.py", line 226, in get_ground_truth self.get_ground_truth_single(img_idx, gt_instances, mask_feat_size=mask_feat_size) File "/code/OSFormer/adet/modeling/osformer/osformer.py", line 279, in get_ground_truth_single gt_masks = imrescale(gt_masks, scale=1. / output_stride) File "/code/OSFormer/adet/modeling/osformer/utils.py", line 166, in imrescale rescaled_img = imresize(img, new_size, interpolation=interpolation) File "/code/OSFormer/adet/modeling/osformer/utils.py", line 90, in imresize resized_img = cv2.resize( cv2.error: OpenCV(4.6.0) /io/opencv/modules/imgproc/src/resize.cpp:3689: error: (-215:Assertion failed) !dsize.empty() in function 'resize'

Singerone commented 1 year ago

I checked that gt_mask is not empty in the original dataset ps:Using my own dataset

Singerone commented 1 year ago

Has anyone ever had this problem?Looking forward to your reply

Patrickctyyx commented 1 year ago

What is the original shape of your img when calling cv2.resize?

Singerone commented 1 year ago

What is the original shape of your img when calling cv2.resize?

(631,512,512),resize(631,128,128)

PJLallen commented 1 year ago

I checked that gt_mask is not empty in the original dataset ps:Using my own dataset

I guess something is wrong with generating the "json" file with your own dataset. you can check it again.

Singerone commented 1 year ago

I checked that gt_mask is not empty in the original dataset ps:Using my own dataset

I guess something is wrong with generating the "json" file with your own dataset. you can check it again.

Hello, I have rechecked the data and json generation files. json uses the format of coco dataset, and mask uses the RLE format.if there is a conflict with this setting? In addition, our label starts from 1 and has only one class. This is because we read cocoapi, except coco data sets generally start from 1, which will not complete the label. In actual reading, gt_label is 0

Singerone commented 1 year ago

I checked that gt_mask is not empty in the original dataset ps:Using my own dataset

I guess something is wrong with generating the "json" file with your own dataset. you can check it again.

Thank you very much for your reply

PJLallen commented 1 year ago

I checked that gt_mask is not empty in the original dataset ps:Using my own dataset

I guess something is wrong with generating the "json" file with your own dataset. you can check it again.

Hello, I have rechecked the data and json generation files. json uses the format of coco dataset, and mask uses the RLE format.if there is a conflict with this setting? In addition, our label starts from 1 and has only one class. This is because we read cocoapi, except coco data sets generally start from 1, which will not complete the label. In actual reading, gt_label is 0

You can refer to our json file. The mask is generated by Polygon, and the label start from 1 in line with coco format.