Giter VIP home page Giter VIP logo

centernet-condinst's Introduction

CenterNet-CondInst

CenterNet: Objects as Points + CondInst: Conditional Convolutions for Instance Segmentation

Installation

Please refer to CnterNet INSTALL.md for installation instructions.

Training

## note : seg_weight default setting is 1. You can set it to other value to get better performance.
cd src
python main.py ctseg --exp_id coco_dla_1x --batch_size 20 --master_batch 9 --lr 1.25e-4 --gpus 0,1 --num_workers 4

Eval

## not support flip test and multi scale test
cd src
python test.py ctseg --exp_id coco_dla_1x --keep_res --resume

Visualization

cd src
python demo.py ctseg --exp_id coco_dla_1x --keep_res --resume --demo ../data/coco/val2017

Result

type AP AP50 AP75 APs APm APl
box 0.358 0.540 0.384 0.154 0.391 0.535
mask 0.306 0.493 0.317 0.100 0.341 0.490

backbone=dla_34, batch=32

Reference

  1. CenterNet
  2. CondInst

centernet-condinst's People

Contributors

caowgg 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

centernet-condinst's Issues

Please upload your opts.py to this repo.

Error:

    self.crit_seg = SegLoss2() if opt.last_conv == '3x3conv' else SegLoss()
AttributeError: 'Namespace' object has no attribute 'last_conv'

It seems like you changed opts.py and didn't add this file into this repo. Can you upload it? Thanks.

关于效果展示

使用demo.py进行训练效果展示的时候只画出了框,但是没有mask

do you use FPN?

the figure in the readme contains FPN. Do you use FPN in the backbone?

How to train cocodataset

Hello, I have a custom dataset annotated in Coco format with coco-annotator. How can I train the data using the model

Model Release

Hi there author,

Thanks for your awesome work of combining CenterNet and CondInst. Can you release the trained model? Such that we can more easily use this work.

backbone mobilenet_light export to onnx

When I export the backbone of mobilenet_light to onnx, some errors:

onnx.export(model, input, "./aa.onnx", export_params=True)

---> 10 onnx.export(model, input, "./aa.onnx", export_params=True)
2 frames
/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py in _export(model, args, f, export_params, verbose, training, input_names, output_names, operator_export_type, export_type, example_outputs, propagate, opset_version, _retain_param_name, do_constant_folding, strip_doc_string, dynamic_axes, keep_initializers_as_inputs, fixed_batch_size)
    392             proto, export_map = graph._export_onnx(
    393                 params_dict, opset_version, dynamic_axes, defer_weight_export,
--> 394                 operator_export_type, strip_doc_string, val_keep_init_as_ip)
    395         else:
    396             proto, export_map = graph._export_onnx(

RuntimeError: ONNX export failed: Couldn't export operator aten::upsample_bilinear2d

And added the opset_version=11:

torch.onnx.export(model, input, onnx_file_path, export_params=True, opset_version=11)

---> 10 torch.onnx.export(model, input, onnx_file_path, export_params=True, opset_version=11)

7 frames
/usr/local/lib/python3.6/dist-packages/torch/onnx/symbolic_helper.py in symbolic_fn(*args, **kwargs)
    173         raise RuntimeError("ONNX export failed on {}, which is not implemented for opset {}. "
    174                            "Try exporting with other opset versions."
--> 175                            .format(name, _export_onnx_opset_version))
    176     return symbolic_fn
    177 

RuntimeError: ONNX export failed on hardtanh, which is not implemented for opset 11. Try exporting with other opset versions.

I did not find anything about hardtanh or tanh.

edit:
ReLU6 is a child of Hardtanh...

class ReLU6(Hardtanh):
   pass

Do you have any idea about that?

关于CenterNet后接segmentation的请教

非常感谢您分享的代码。

由于我暂时还没有配置成功代码,所以只能干看代码,没法调试。

有一个问题想请教一下,就是原始的CenterNet的输出有三个分支,分别是 heatmap (W*H*C),offset (W*H*2)和size (W*H*2),然后你这里加了一个seg_feat,这个分支是怎么加的,能介绍一下吗?能否告知是在代码的哪一处?这里的seg_feat它的size是什么样子的?怎么为每个中心点分配一个mask?难道与offset和size一样,预测一个 W*H*W*H的seg_feat?

此外,代码中关于dice loss的计算,我也不是很明白:

    def forward(self, seg_feat, conv_weight, mask,ind, target):
        mask_loss=0.
        batch_size = seg_feat.size(0)
        weight = _tranpose_and_gather_feat(conv_weight, ind)
        h,w = seg_feat.size(-2),seg_feat.size(-1)
        x,y = ind%w,ind/w
        x_range = torch.arange(w).float().to(device=seg_feat.device)
        y_range = torch.arange(h).float().to(device=seg_feat.device)
        y_grid, x_grid = torch.meshgrid([y_range, x_range])
        for i in range(batch_size):
            num_obj = target[i].size(0)
            conv1w,conv1b,conv2w,conv2b,conv3w,conv3b= \
                torch.split(weight[i,:num_obj],[(self.feat_channel+2)*self.feat_channel,self.feat_channel,
                                          self.feat_channel**2,self.feat_channel,
                                          self.feat_channel,1],dim=-1)
            y_rel_coord = (y_grid[None,None] - y[i,:num_obj].unsqueeze(-1).unsqueeze(-1).unsqueeze(-1).float())/128.
            x_rel_coord = (x_grid[None,None] - x[i,:num_obj].unsqueeze(-1).unsqueeze(-1).unsqueeze(-1).float())/128.
            feat = seg_feat[i][None].repeat([num_obj,1,1,1])
            feat = torch.cat([feat,x_rel_coord, y_rel_coord],dim=1).view(1,-1,h,w)

            conv1w=conv1w.contiguous().view(-1,self.feat_channel+2,1,1)
            conv1b=conv1b.contiguous().flatten()
            feat = F.conv2d(feat,conv1w,conv1b,groups=num_obj).relu()

            conv2w=conv2w.contiguous().view(-1,self.feat_channel,1,1)
            conv2b=conv2b.contiguous().flatten()
            feat = F.conv2d(feat,conv2w,conv2b,groups=num_obj).relu()

            conv3w=conv3w.contiguous().view(-1,self.feat_channel,1,1)
            conv3b=conv3b.contiguous().flatten()
            feat = F.conv2d(feat,conv3w,conv3b,groups=num_obj).sigmoid().squeeze()

            true_mask = mask[i,:num_obj,None,None].float()
            mask_loss+=dice_loss(feat*true_mask,target[i]*true_mask)

        return mask_loss/batch_size

里面还进行了卷积计算?能否说明一下思路?

非常期待您的回复。

准确率问题

我跑了一下2017的数据集,貌似准确率不太高,问一下可以出个detectron2版吗,源码绕来绕去不好迁移

关于运行时间的问题

请问这里面提到的时间具体都是什么意思?
'tot', 'load', 'pre', 'net', 'dec', 'post', 'merge'
处理一帧的时间要100多ms吗???

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.