Git Product home page Git Product logo

Comments (5)

lifuguan avatar lifuguan commented on May 25, 2024

Results

I'm using 2.19.0 exactly, and the results show no GAP between my implementation and the official version.

Tips

The official checkpoint file should be modified before you use it because the key names don't match.

Code

import torch
import re
dict = torch.load("/disk1/lihao/model_zoo/solo/SOLOv2_R50_1x.pth")
patt='mask_feat_head'
pattern = re.compile(patt)
key_list = list(dict['state_dict'].keys())
for older_val in key_list:
    if len(pattern.findall(older_val)) != 0:
        val = re.sub('mask_feat_head', 'mask_head', older_val)
        dict['state_dict'][val] = dict['state_dict'].pop(older_val)
print(dict['state_dict'].keys())
torch.save(dict, '/disk1/lihao/model_zoo/solo/SOLOv2_fpn_R50_1x.pth')

Example

image

from solov2-mmdet.

pupu-chenyanyan avatar pupu-chenyanyan commented on May 25, 2024

from solov2-mmdet.

wptoux avatar wptoux commented on May 25, 2024

请问为什么要把mask_feat_head替换成mask_head呢?

from solov2-mmdet.

lifuguan avatar lifuguan commented on May 25, 2024

请问为什么要把mask_feat_head替换成mask_head呢?

mask_feat_head和mask_head对应mmdet中组件的变量名,类似于backbone,bbox_head

关于mask_feat_head

mask_feat_head是mmdet 1.x版本中single_stage_ins.py中的变量名字

关于mask_head

在mmdet 2.x版本中,single_stage_ins.pybase.py的继承子类,其变量名在mmdet.models.detectors.base.py中已经被定义,如下:

    @property
    def with_mask(self):
        """bool: whether the detector has a mask head"""
        return ((hasattr(self, 'roi_head') and self.roi_head.with_mask)
                or (hasattr(self, 'mask_head') and self.mask_head is not None))

所以,只能修改变量名字以适配mmdet 2.x

from solov2-mmdet.

lifuguan avatar lifuguan commented on May 25, 2024

Thank you for great reply. I'm using 2.22.0 mmdet. I actually retrain solov2 for cityscapes dataset. And the  cityscapes annotations have been converted into the coco format using the cityscapesScripts toolbox according the WXinlong/SOLO  in github. The cityscapes.json like that: {"images":[{ "id":0,"width":2048,“height”: ,:"filename": ,"seg_file_name": .............] "categories":["id":1,"name":"person",.............], "annotations":[{"id": 0, "image_id: 0,"segmentation":[[953,406,,,,,,,]],"category_id": ,"iscrwd":,"area" :   ,"bbox":[]}..... And i modifiled the configs and so no. Strangely enough,  it can train normally, but the results are very bad,the AP is only 0.02%. In fact, I checked the Dataloader carefully and found no problem. Can  you  consider adding Cityscapes config file for SOLOv2 training?Thank you very much ! 

------------------ 原始邮件 ------------------ 发件人: "lifuguan/SOLOv2-mmdet" @.>; 发送时间: 2022年3月15日(星期二) 下午5:11 @.>; @.@.>; 主题: Re: [lifuguan/SOLOv2-mmdet] the result is very strange (Issue #1) Results I'm using 2.19.0 exactly, and the results show no GAP between my implementation and the official version. Tips The official checkpoint file should be modified before you use due to the fact that the key names don't match. Code import torch import re dict = torch.load("/disk1/lihao/model_zoo/solo/SOLOv2_R50_1x.pth") patt='mask_feat_head' pattern = re.compile(patt) key_list = list(dict['state_dict'].keys()) for older_val in key_list: if len(pattern.findall(older_val)) != 0: val = re.sub('mask_feat_head', 'mask_head', older_val) dict['state_dict'][val] = dict['state_dict'].pop(older_val) print(dict['state_dict'].keys()) torch.save(dict, '/disk1/lihao/model_zoo/solo/SOLOv2_fpn_R50_1x.pth') Example — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

In general, the model should be fine. Maybe you can load an official checkpoint file, and run a demo.py to find out whether the model can detect targets or not.

from solov2-mmdet.

Related Issues (4)

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.