Closed StudioTV closed 2 years ago
You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template. The following information is missing: "Your Environment";
It seems like Detectron2 can't work with uncompressed RLE, so I had to convert it to the compressed version. It was a real struggle, this is how I did it :
The code if it can help anyone :
bitmask = rle2mask(string_RLE,shape=(img_h, img_w))
bitmask = np.asfortranarray(bitmask)
encoded_ground_truth = pycocotools.mask.encode(bitmask )
And then
"segmentation":
{
"size": [img_h, img_w],
"counts" : encoded_ground_truth["counts"].decode('ascii')
},
Hello guys !
First of all, thank you to the team of Facebook for this amazing tool. I am using detectron2 for a lot of projects now and I have never faced a problem like this before. I have a CocoDataset using RLE for segmentation, you can see an example here :
Since the end of 2019, detectron2 has been natively able to read RLE, as seen in the official documentation.
But It actually doesn't work, I tried a lot of parameters, but I still have a really weird error message that I can't debug, that's why I am asking you guys. I tried with and without the
cfg.INPUT.MASK_FORMAT='bitmask'
but it doesn't work.I tried the simple COCO detection, and the model is working fine, I also tried to put random polygons and not RLE and it also works great, so it seems like there is something wrong with RLE.
Instructions To Reproduce the 🐛 Bug:
Full runnable code or full changes you made:
[05/27 15:11:30 d2.data.dataset_mapper]: [DatasetMapper] Augmentations used in training: [ResizeShortestEdge(short_edge_length=(640, 672, 704, 736, 768, 800), max_size=1333, sample_style='choice'), RandomFlip()] [05/27 15:11:30 d2.data.build]: Using training sampler TrainingSampler [05/27 15:11:30 d2.data.common]: Serializing 13297 elements to byte tensors and concatenating them all ... [05/27 15:11:30 d2.data.common]: Serialized dataset takes 10.90 MiB [05/27 15:11:35 d2.engine.train_loop]: Starting training from iteration 0 ERROR [05/27 15:12:10 d2.engine.train_loop]: Exception during training: Traceback (most recent call last): File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 986, in _try_get_data data = self._data_queue.get(timeout=timeout) File "E:\anaconda3\envs\detectron2\lib\multiprocessing\queues.py", line 108, in get raise Empty _queue.Empty
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\train_loop.py", line 149, in train self.run_step() File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\defaults.py", line 494, in run_step self._trainer.run_step() File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\train_loop.py", line 267, in run_step data = next(self._data_loader_iter) File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\data\common.py", line 234, in iter for d in self.dataset: File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 517, in next data = self._next_data() File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 1182, in _next_data idx, data = self._get_data() File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 1148, in _get_data success, data = self._try_get_data() File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 999, in _try_get_data raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str)) from e RuntimeError: DataLoader worker (pid(s) 14736) exited unexpectedly [05/27 15:12:10 d2.engine.hooks]: Total training time: 0:00:35 (0:00:00 on hooks) [05/27 15:12:10 d2.utils.events]: iter: 0 lr: N/A max_mem: 173M Traceback (most recent call last): File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 986, in _try_get_data data = self._data_queue.get(timeout=timeout) File "E:\anaconda3\envs\detectron2\lib\multiprocessing\queues.py", line 108, in get raise Empty _queue.Empty
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "train.py", line 115, in
train()
File "train.py", line 112, in train
trainer.train()
File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\defaults.py", line 484, in train
super().train(self.start_iter, self.max_iter)
File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\train_loop.py", line 149, in train
self.run_step()
File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\defaults.py", line 494, in run_step
self._trainer.run_step()
File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\engine\train_loop.py", line 267, in run_step
data = next(self._data_loader_iter)
File "e:\XXXXXXX\model\detectron2\detectron2-main\detectron2\data\common.py", line 234, in iter
for d in self.dataset:
File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 517, in next
data = self._next_data()
File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 1182, in _next_data
idx, data = self._get_data()
File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 1148, in _get_data
success, data = self._try_get_data()
File "E:\anaconda3\envs\detectron2\lib\site-packages\torch\utils\data\dataloader.py", line 999, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str)) from e
RuntimeError: DataLoader worker (pid(s) 14736) exited unexpectedly
sys.platform win32 Python 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)] numpy 1.19.5 detectron2 0.6 @e:\XXXXXX\model\detectron2\detectron2-main\detectron2 detectron2._C not built correctly: DLL load failed while importing _C: La procédure spécifiée est introuvable. DETECTRON2_ENV_MODULE
PyTorch 1.8.2+cu102 @E:\anaconda3\envs\detectron2\lib\site-packages\torch
PyTorch debug build False
GPU available Yes
GPU 0 NVIDIA GeForce GTX 1080 Ti (arch=6.1)
Driver version 512.95
CUDA_HOME C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
Pillow 8.1.2
torchvision 0.9.2+cu102 @E:\anaconda3\envs\detectron2\lib\site-packages\torchvision
torchvision arch flags E:\anaconda3\envs\detectron2\lib\site-packages\torchvision_C.pyd; cannot find cuobjdump
fvcore 0.1.5.post20220512
iopath 0.1.9
cv2 4.5.1
PyTorch built with: