Code Monkey home page Code Monkey logo

polarmask's Introduction

polarmask's People

Contributors

whai362 avatar xieenze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polarmask's Issues

Questions about Distance Label Generation Algorithm

Hi, thanks for sharing the code.

When I was training PolarMask, I noticed there are a lot of coordinate be targeted as the minimum number 10^-6. I am confused about why not chose the points outside $\Delta \theta$. Does this affect the results?

Thanks a lot!

想用ResNet18,请问怎么配置

大佬。我的数据集是特征比较少的图片,想用resnet18。
请问configs里
# model settings model = dict( type='PolarMask', pretrained='open-mmlab://resnet50_caffe', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=False), style='caffe'),
pretrained='open-mmlab://resnet50_caffe',要改成pretrained='open-mmlab://resnet18_caffe'吗。好像没有这个。
要是光改depth,会有RuntimeError: Given groups=1, weight of size 256 512 1 1, expected input[4, 128, 64, 64] to have 512 channels, but got 128 channels instead这个错。实在是迷茫了。望大佬解答,谢谢

some problem

不好意思又打擾您了
問題1:
在使用coco_seg_fast時
所訓練出來的mask方向會是錯的
coco_seg則沒問題

問題2:
在計算MaskIOULoss時
會出現NaN的情況
不知道是什麼樣的情況會造成

polar iou loss

论文中提到了使用polar iou loss。为啥我在这里没有看到呢。

About the bbox loss

I see there are totally 4 lossese in your code, (centerness, cls, mask, and bbox). The bbox loss is not mentioned in the paper, is the same loss with FCOS?

Finetune error: numclass mismath

i trained the model on my custom dataset whose number of classes is only 1, and i wanna finetune the existing checkpoint file downloaded from your google drive, due to the mismatch of dimensions, a runtime error raised:

While copying the parameter named bbox_head.polar_cls.weight, whose dimensions in the model are torch.Size([1, 256, 3, 3]) and whose dimensions in the checkpoint are torch.Size([80, 256, 3, 3])

this might because that i have changed the numclasses, but i still want to use your checkpoint file to finetune, how to solve that?

What does it mean?

mask centerness is smaller than origin centerness, so add a constant is important or the score will be too low.
It is in your 'mmdet/models/anchor_heads/polarmask_head.py', if the centerness is din/dmax, then it should not be negtive, but actually it has.

How does number of Rays affects FPS

Hi Enze!
I saw you have do experiment about number of Rays in you paper(Table1 a). It illustrate that more rays product higher AP. So what about FPS? Have you ever do such experiment that how does number of Rays affects FPS?

It seems that the FPS should be lower when we use more ray for mask representation, but in my experiment(some other dataset), the result is reversed! I got higher AP and lower FPS when I use less rays for mask.

I hope for your reply!

train on custom data with custom input size

Hello,
Thanks for your work and for sharing it too.
I want to change the input size, but unfortunately, when I changed it (change it in the configuration) I have errors regarding the shapes so could u tell me how to change it safely?

是否使用了GN?

# model settings
model = dict(
    type='FCOS',
    pretrained='open-mmlab://resnet50_caffe',
    backbone=dict(
        type='ResNet',
        depth=50,
        num_stages=4,
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        norm_cfg=dict(type='BN', requires_grad=False),
        style='caffe'),

在readme中使用了GN,但配置文件里norm_cfg类型用的是BN。

A question in `coco_seg.py`, `get_centerpoint` area==0.0

Hi~ nice work!
I have a problem when I train my own dataset (coco format converted).

During my training , I encounted a problem in the get_centerpoint function.
The area seem to be zero and I got a warning says divided by zero.
So I try to print it. I am realy confused about this problem and the lack of comment in the code also make it hard to figure it out.

def get_centerpoint(self, lis):
        area = 0.0
        x, y = 0.0, 0.0
        a = len(lis)
        for i in range(a):
            lat = lis[i][0]
            lng = lis[i][1]
            if i == 0:
                lat1 = lis[-1][0]
                lng1 = lis[-1][1]
            else:
                lat1 = lis[i - 1][0]
                lng1 = lis[i - 1][1]
            fg = (lat * lng1 - lng * lat1) / 2.0
            area += fg
            x += fg * (lat + lat1) / 3.0
            y += fg * (lng + lng1) / 3.0
        if area == 0.0:
            pass
            # print("area == 0.0, x : {}, y : {}".format(x, y), lis)
        else:
            x = x / area
            y = y / area
        return [int(x), int(y)]

Full log:

...
 [843 767]]
2020-04-19 10:38:54,416 - INFO - Epoch(train) [583][40] loss_cls: 0.4523, loss_bbox: 0.5393, loss_mask: 0.3463, loss_centerness: 0.6634, loss: 2.0013
2020-04-19 10:39:11,762 - INFO - Epoch [584][10/43]     lr: 0.00010, eta: 8:00:18, time: 1.734, data_time: 0.892, memory: 4557, loss_cls: 0.4345, loss_bbox: 0.4793, loss_mask: 0.3151, loss_center
ness: 0.6616, loss: 1.8906
2020-04-19 10:39:30,440 - INFO - Epoch [584][20/43]     lr: 0.00010, eta: 8:00:16, time: 1.868, data_time: 1.033, memory: 4557, loss_cls: 0.4390, loss_bbox: 0.5169, loss_mask: 0.3345, loss_center
ness: 0.6509, loss: 1.9413
2020-04-19 10:39:49,206 - INFO - Epoch [584][30/43]     lr: 0.00010, eta: 8:00:13, time: 1.877, data_time: 0.957, memory: 4557, loss_cls: 0.4296, loss_bbox: 0.4967, loss_mask: 0.3055, loss_center
ness: 0.6626, loss: 1.8945
2020-04-19 10:40:05,576 - INFO - Epoch [584][40/43]     lr: 0.00010, eta: 8:00:08, time: 1.637, data_time: 0.809, memory: 4557, loss_cls: 0.4507, loss_bbox: 0.4983, loss_mask: 0.3048, loss_center
ness: 0.6665, loss: 1.9203
area == 0.0, x : 6.111804395914078e-10, y : 5.820766091346741e-11 [[842 767]
 [843 767]
...
 [843 767]]
2020-04-19 10:41:00,330 - INFO - Epoch(train) [584][40] loss_cls: 0.4574, loss_bbox: 0.5293, loss_mask: 0.3352, loss_centerness: 0.6638, loss: 1.9857
2020-04-19 10:41:18,880 - INFO - Epoch [585][10/43]     lr: 0.00010, eta: 7:59:59, time: 1.854, data_time: 1.040, memory: 4557, loss_cls: 0.4286, loss_bbox: 0.4867, loss_mask: 0.3002, loss_center
ness: 0.6559, loss: 1.8715
2020-04-19 10:41:34,075 - INFO - Epoch [585][20/43]     lr: 0.00010, eta: 7:59:52, time: 1.520, data_time: 0.679, memory: 4557, loss_cls: 0.4494, loss_bbox: 0.5074, loss_mask: 0.3356, loss_center
ness: 0.6583, loss: 1.9507
2020-04-19 10:41:51,644 - INFO - Epoch [585][30/43]     lr: 0.00010, eta: 7:59:49, time: 1.757, data_time: 0.932, memory: 4557, loss_cls: 0.4346, loss_bbox: 0.5247, loss_mask: 0.3162, loss_center
ness: 0.6666, loss: 1.9420
2020-04-19 10:42:08,032 - INFO - Epoch [585][40/43]     lr: 0.00010, eta: 7:59:43, time: 1.639, data_time: 0.799, memory: 4557, loss_cls: 0.4362, loss_bbox: 0.4918, loss_mask: 0.3061, loss_center
ness: 0.6585, loss: 1.8926
area == 0.0, x : 6.111804395914078e-10, y : 5.820766091346741e-11 [[842 767]
 [843 767]
 [844 767]
 [845 767]
...

2020-04-19 10:42:58,642 - INFO - Epoch(train) [585][40] loss_cls: 0.4544, loss_bbox: 0.5306, loss_mask: 0.3328, loss_centerness: 0.6638, loss: 1.9815
2020-04-19 10:43:14,731 - INFO - Epoch [586][10/43]     lr: 0.00010, eta: 7:59:31, time: 1.608, data_time: 0.738, memory: 4557, loss_cls: 0.4248, loss_bbox: 0.4993, loss_mask: 0.3406, loss_center
ness: 0.6482, loss: 1.9130
2020-04-19 10:43:31,372 - INFO - Epoch [586][20/43]     lr: 0.00010, eta: 7:59:27, time: 1.664, data_time: 0.794, memory: 4557, loss_cls: 0.4362, loss_bbox: 0.5187, loss_mask: 0.3146, loss_center
ness: 0.6643, loss: 1.9338
2020-04-19 10:43:50,346 - INFO - Epoch [586][30/43]     lr: 0.00010, eta: 7:59:24, time: 1.897, data_time: 1.060, memory: 4557, loss_cls: 0.4261, loss_bbox: 0.4872, loss_mask: 0.3006, loss_center
ness: 0.6591, loss: 1.8730
2020-04-19 10:44:06,737 - INFO - Epoch [586][40/43]     lr: 0.00010, eta: 7:59:19, time: 1.639, data_time: 0.801, memory: 4557, loss_cls: 0.4409, loss_bbox: 0.5108, loss_mask: 0.3111, loss_center
ness: 0.6614, loss: 1.9243
area == 0.0, x : 6.111804395914078e-10, y : 5.820766091346741e-11 [[842 767]
 [843 767]
 [844 767]
 [845 767]
...

It seems every 40 epochs encounter the same problem.

  1. Is that matter area become zero?
  2. Why this happened?
  3. How can I solve this?

In order to make sure the dataset format I make is correct, I have also trained it using mask rcnn, everthing works fine.

test error: UnboundLocalError: local variable '_mlvl_bboxes' referenced before assignment

when I executed python tools/test.py configs/polarmask/4gpu/polar_768_1x_r50.py /root/coco/r50_1x.pth --show, I got the error as title. And I am confused in the polarmask_head.py.
`
def get_bboxes_single

    mlvl_bboxes = torch.cat(mlvl_bboxes)
    mlvl_masks = torch.cat(mlvl_masks)
    if rescale:
        _mlvl_bboxes = mlvl_bboxes / mlvl_bboxes.new_tensor(scale_factor)
        try:
            scale_factor = torch.Tensor(scale_factor)[:2].cuda().unsqueeze(1).repeat(1, 36)
            _mlvl_masks = mlvl_masks / scale_factor
        except:
            _mlvl_masks = mlvl_masks / mlvl_masks.new_tensor(scale_factor)
    mlvl_scores = torch.cat(mlvl_scores)
    padding = mlvl_scores.new_zeros(mlvl_scores.shape[0], 1)
    mlvl_scores = torch.cat([padding, mlvl_scores], dim=1)
    mlvl_centerness = torch.cat(mlvl_centerness)
    centerness_factor = 0.5  # mask centerness is smaller than origin centerness, so add a constant is important or the score will be too low.
    if self.mask_nms:
        '''1 mask->min_bbox->nms, performance same to origin box'''
        a = _mlvl_masks
        _mlvl_bboxes = torch.stack([a[:, 0].min(1)[0],a[:, 1].min(1)[0],a[:, 0].max(1)[0],a[:, 1].max(1)[0]],-1)
        det_bboxes, det_labels, det_masks = multiclass_nms_with_mask(
            _mlvl_bboxes,
            mlvl_scores,
            _mlvl_masks,
            cfg.score_thr,
            cfg.nms,
            cfg.max_per_img,
            score_factors=mlvl_centerness + centerness_factor)

    else:
        '''2 origin bbox->nms, performance same to mask->min_bbox'''
        det_bboxes, det_labels, det_masks = multiclass_nms_with_mask(
            _mlvl_bboxes,
            mlvl_scores,
            _mlvl_masks,
            cfg.score_thr,
            cfg.nms,
            cfg.max_per_img,
            score_factors=mlvl_centerness + centerness_factor)

    return det_bboxes, det_labels, det_masks`

In the function get_bboxes_single, the variables _mlvl_bboxes and _mlvl_masks are both used after if self.mask_nms, but if rescale is False, the _mlvl_bboxes and _mlvl_masks is not assignmented, so I got the error.
Then I set the rescale always True, but I got another error by img_show[mask] = img_show[mask] * 0.5 + color_mask * 0.5 in base.py
IndexError: boolean index did not match indexed array along dimension 0; dimension is 768 but corresponding boolean dimension is 427

没太看懂你的polarmask_head.py

hi,尝试了你的代码,几次都没运行成功,所以仔细看了一下的源码,关于PolarMask\mmdet\models\anchor_heads\polarmask_head.py,这部分代码中,line 208,loss函数,我并没有看到你对gt有任何的处理,并且line 225,输出的三个object的维度有时候会是错误的,所以我想了解一下你loss计算中,gt是如何使用的,感谢

我出现的错误:

错误一:

File "PolarMask/mmdet/core/bbox/transforms.py", line 215, in distance2bbox x1 = points[:, 0] - distance[:, 0] IndexError: too many indices for tensor of dimension 1

错误二:
File "PolarMask/mmdet/models/losses/mask_iou_loss.py", line 24, in forward total = torch.stack([pred, target], -1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 2. Got 4 and 36 in dimension 1 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71

基本都是输出维度导致的

关于Polar IoU的问题

您好,我对于您论文中的Polar IoU有些疑问
(1) 公式 (6) 中的 d_{min} = min(d,d*) 应该是指 min(d_i, d*_i)吧? 就是说在累加的时候,应该是遍历d_i 和d*_i的吧?
(2)把公式(6)换成公式(7)会提升一些性能,但这样似乎失去了IoU本身的含义,感觉有点玄学

希望能解答一下,谢谢!

Question about demo

hello, i'm having some problems about demo.
i have organized your visualize.ipynb into demo.py and prepared the environment .
but i get this error:
File "/mnt/ljc/InstanceSeg/PolarMask/mmdet/ops/nms/nms_wrapper.py", line 43, in nms inds = nms_cuda.nms(dets_th, iou_thr) RuntimeError: CUDA error: invalid device function (launch_kernel at /opt/conda/conda-bld/pytorch_1579022060824/work/aten/src/ATen/native/cuda/Loops.cuh:103) frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x47 (0x7f77d58ca627 in /mnt/ljc/anaconda3/envs/ame/lib/python3.7/site-packages/torch/lib/libc10.so) frame #1: void at::native::gpu_index_kernel<__nv_dl_wrapper_t<__nv_dl_tag<void (*)(at::TensorIterator&, c10::ArrayRef<long>, c10::ArrayRef<long>), &(void at::native::index_kernel_impl<at::native::OpaqueType<8> >(at::TensorIterator&, c10::ArrayRef<long>, c10::ArrayRef<long>)), 1u>> >(at::TensorIterator&, c10::ArrayRef<long>, c10::ArrayRef<long>, __nv_dl_wrapper_t<__nv_dl_tag<void (*)(at::TensorIterator&, c10::ArrayRef<long>, c10::ArrayRef<long>), &(void at::native::index_kernel_impl<at::native::OpaqueType<8> >(at::TensorIterator&, c10::ArrayRef<long>, c10::ArrayRef<long>)), 1u>> const&) + 0x78d (0x7f77dcd1768d in /mnt/ljc/anaconda3/envs/ame/lib/python3.7/site-packages/torch/lib/libtorch.so) ....
do u know why ?
I used one gpu for the demo, Is it not suitable for the model of 4gpu?

Train with own dataset.

How to train with your own dataset?
I converted the data to coco format; Some file configuration changes were made following mmdetection.
But the training result label is still coco's.

About target preparation

Hi, sorry to bother you again.
I notice that u fix the size of imgs at (1280, 768), and I get lots of bug when I try to keep img ratio.
I wonder whether it is target preparation in coco_seg.py that cause those problems. Have u try to keep img ratio instead of fixed size?

about debug IndexError: list index out of range

Thanks for your contribution.

yep,you have mentioned that debug IndexError: list index out of range' in coco_seg.py`

I try to use your model polar_768_1x_r50_4gpu to train coco-style datasets.At first,it can be trained using the coco-style dataset,and then a error occured as shown below.Before fix the bug,I want to determine if the problem is caused by the dataset format itself or by the dataset conversion.

2019-10-18 09:20:17,323 - INFO - Epoch [1][180/320]	lr: 0.00572, eta: 2:48:15, time: 1.506, data_time: 0.044, memory: 6851, loss_cls: 0.1853, loss_bbox: 0.6263, loss_mask: 0.3083, loss_centerness: 0.5536, loss: 1.6735
2019-10-18 09:20:46,074 - INFO - Epoch [1][190/320]	lr: 0.00585, eta: 2:48:10, time: 2.875, data_time: 0.139, memory: 6851, loss_cls: 0.1767, loss_bbox: 0.6881, loss_mask: 0.3242, loss_centerness: 0.5494, loss: 1.7385

IndexError: Caught IndexError in DataLoader worker process 1.
 count = contour[0][:, 0, :]
IndexError: list index out of range

thanks for your help inadvance.

AttributeError: 'NoneType' object has no attribute 'values'

您好,我在训练的时候遇到了extra_data值为空的问题,我打印出‘_gt_masks’,‘_gt_labels’,‘_gt_bboxes’发现全部都是None,我想为什么会出现这样的问题?感谢回复。
labels_list, bbox_targets_list, mask_targets_list = extra_data.values() AttributeError: 'NoneType' object has no attribute 'values'

Some questions about the speed.

I have tested the ResNet-50 with one GTX TITANX, however,
with(1280, 768) --> FPS =5,
with(667, 400) --> FPS = 7,
Firstly, it is far slower than the paper's speed (8.9&19.0, respectively);
Secondly, why the speeds of different scales is so near, 400 shares only 1/4 computation compared with 800 in model, is that means the post-process is time-consuming?

debug in coco_seg.py

when I debug in coco_seg.py , I have problem like this

Exception in thread Thread-534:
Traceback (most recent call last):
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/asyncio/selector_events.py", line 256, in _add_reader
key = self._selector.get_key(fd)
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/selectors.py", line 192, in get_key
raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '20 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/IPython/terminal/debugger.py", line 102, in in_thread
line = self.pt_app.prompt()
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py", line 997, in prompt
return self.app.run()
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 810, in run
return loop.run_until_complete(self.run_async(pre_run=pre_run))
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
return future.result()
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 777, in run_async
return await _run_async2()
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 759, in _run_async2
result = await _run_async()
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 682, in _run_async
with self.input.attach(read_from_input):
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/contextlib.py", line 112, in enter
return next(self.gen)
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/site-packages/prompt_toolkit/input/vt100.py", line 176, in _attached_input
loop.add_reader(fd, callback)
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/asyncio/selector_events.py", line 329, in add_reader
return self._add_reader(fd, callback, *args)
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/asyncio/selector_events.py", line 259, in _add_reader
(handle, None))
File "/home/wh/miniconda3/envs/polarmask/lib/python3.7/selectors.py", line 359, in register
self._selector.register(key.fd, poller_events)
PermissionError: [Errno 1] Operation not permitted

Dimension out of range (expected to be in range of [-2, 1], but got 2)

您好
我是使用自己的數據集 只有分兩類
但是在訓練時一直出現這個錯誤

flatten_bbox_preds: torch.Size([40920, 4])
flatten_mask_targets: torch.Size([40920])
points: torch.Size([2804, 2])
distance: torch.Size([2804, 4])
points: torch.Size([2804, 2])
distance: torch.Size([2804, 4])
pred: torch.Size([2804, 36])
target: torch.Size([2804])

Traceback (most recent call last):
File "tools/train.py", line 154, in
main()
File "tools/train.py", line 123, in main
logger=logger)
File "/home/Hou/PolarMask/mmdet/apis/train.py", line 60, in train_detector
_non_dist_train(model, dataset, cfg, validate=validate)
File "/home/Hou/PolarMask/mmdet/apis/train.py", line 221, in _non_dist_train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 359, in run
epoch_runner(data_loaders[i], **kwargs)
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 263, in train
self.model, data_batch, train_mode=True, **kwargs)
File "/home/Hou/PolarMask/mmdet/apis/train.py", line 38, in batch_processor
losses = model(**data)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
return self.module(*inputs[0], **kwargs[0])
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/Hou/PolarMask/mmdet/core/fp16/decorators.py", line 49, in new_func
return old_func(*args, **kwargs)
File "/home/Hou/PolarMask/mmdet/models/detectors/base.py", line 86, in forward
return self.forward_train(img, img_meta, **kwargs)
File "/home/Hou/PolarMask/mmdet/models/detectors/polarmask.py", line 55, in forward_train
extra_data=extra_data
File "/home/Hou/PolarMask/mmdet/core/fp16/decorators.py", line 127, in new_func
return old_func(*args, **kwargs)
File "/home/Hou/PolarMask/mmdet/models/anchor_heads/polarmask_head.py", line 289, in loss
avg_factor=pos_centerness_targets.sum())
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/Hou/PolarMask/mmdet/models/losses/mask_iou_loss.py", line 23, in forward
total = torch.stack([pred,target], -1)
IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

我有把pred 和 target 印出來看看
不知道為什麼我的 target 只有一維
flatten_mask_targets 也是 應該要是[x,36]
(有時會會有二維 但不是[x,36] 而是像 target: torch.Size([34, 4]))

這種情況不一定每次都出現 可能訓練到一半才出現 或是一開始就出現
不知道您有沒有遇過類似的問題能夠幫忙解決 感謝

关于groud_truth

我想问一下在计算loss的时候,
labels, bbox_targets, mask_targets = self.polar_target(all_level_points, extra_data)
这里的extra_data是怎么计算的

Trained models

Can you provide Baidu Driver?I can not download from Google driver. And what is the models input and output?

About remaining bbox branch

Hello, thanks for nice work!
I notice the remaining bbox branch in your fcos instance head, and its loss too. And it's said 'we do not have the bounding box prediction head in PolarMask for simplicity and faster speed' in your paper.
So I think u may ignore bbox branch in inferencing model, but use its loss back propagation in training model. Have u ever tried to make it bbox-free in both training and inferencing?

error using test.py

hi

i get this error when trying to use tools\test.py:
PolarMask$ python tools/test.py demo/polar_r101.py demo/r101_1x.pth --show loading annotations into memory... Done (t=0.00s) creating index... index created! [ ] 0/192, elapsed: 0s, ETA:Traceback (most recent call last): File "tools/test.py", line 224, in <module> main() File "tools/test.py", line 184, in main outputs = single_gpu_test(model, data_loader, args.show) File "tools/test.py", line 26, in single_gpu_test result = model(return_loss=False, rescale=not show, **data) File "/home/me/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__ result = self.forward(*input, **kwargs) File "/home/me/.local/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward return self.module(*inputs[0], **kwargs[0]) File "/home/me/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__ result = self.forward(*input, **kwargs) File "/home/me/Desktop/PolarMask/mmdet/core/fp16/decorators.py", line 49, in new_func return old_func(*args, **kwargs) File "/home/me/Desktop/PolarMask/mmdet/models/detectors/base.py", line 88, in forward return self.forward_test(img, img_meta, **kwargs) File "/home/me/Desktop/PolarMask/mmdet/models/detectors/base.py", line 79, in forward_test return self.simple_test(imgs[0], img_metas[0], **kwargs) File "/home/me/Desktop/PolarMask/mmdet/models/detectors/polarmask.py", line 65, in simple_test bbox_list = self.bbox_head.get_bboxes(*bbox_inputs) File "/home/me/Desktop/PolarMask/mmdet/core/fp16/decorators.py", line 127, in new_func return old_func(*args, **kwargs) File "/home/me/Desktop/PolarMask/mmdet/models/anchor_heads/polarmask_head.py", line 403, in get_bboxes scale_factor, cfg, rescale) File "/home/me/Desktop/PolarMask/mmdet/models/anchor_heads/polarmask_head.py", line 480, in get_bboxes_single _mlvl_bboxes, UnboundLocalError: local variable '_mlvl_bboxes' referenced before assignment

please note that:

  • i can inference successfully using the demo/inference_demo.ipynb
  • i am using my own coco dataset and i added the mydataset.py:

from .coco import CocoDataset
from .registry import DATASETS
@DATASETS.register_module
class FishesDataset(CocoDataset):
CLASSES = ('fish')
and imported it in init with:
from .fishes import FishesDataset

-i am using this config file
polar_r101_py.txt

Acc/speed trade-off

Hi, I would like to know if the acc/speed trade-off on ResNet-50, i.e., scale-400/600/800, just simply trained with 800 then using different scale during inference, or just train multi models, respectively?

How about calculate the average coordinates of all pixels in masks to get the center point?

When I use your code on CityScapes, I get this:
~/PolarMask-master/mmdet/datasets/coco_seg.py:512: RuntimeWarning: invalid value encountered in double_scalars x = x / area
~/PolarMask-master/mmdet/datasets/coco_seg.py:513: RuntimeWarning: invalid value encountered in double_scalars y = y / area
And when I check the code, I am confused.
It seems like you use the contour to get the center point, but how about calculate the average coordinates of all pixels in masks to get the center point? I think it will not have warnings in this way.

Polygon3 import error

I installed the Polygon3 module using pip, but when i import Polygon, it says

from Polygon.cPolygon import *
ImportError: /home/...open-mmlab/lib/python3.7/site-packages/Polygon/cPolygon.cpython-37m-x86_64-linux-gnu.so: undefined symbol: alloca

Have you met the same problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.