Skip to content

Conversation

RangiLyu
Copy link
Owner

Support load timm backbones

There are hundreds of pre-trained backbones in timm https://github.com/rwightman/pytorch-image-models

With this PR, you can directly use these backbones in NanoDet.

Usage

For example, to use mobilenet v3 in timm:

First install timm by running pip install timm

Then create a config like this

model:
  arch:
    name: NanoDetPlus
    detach_epoch: 10
    backbone:
      name: TIMMWrapper
      model_name: mobilenetv3_large_100
      features_only: True
      pretrained: True
      output_stride: 32
      out_indices: [2, 3, 4]
    fpn:
      name: GhostPAN
      in_channels: [40, 112, 960]
      ... ...

@RangiLyu RangiLyu added the enhancement New feature or request label Jan 29, 2022
@codecov
Copy link

codecov bot commented Jan 29, 2022

Codecov Report

Merging #399 (2e6d3e5) into main (b7600c8) will increase coverage by 0.08%.
The diff coverage is 76.92%.

@@            Coverage Diff             @@
##             main     #399      +/-   ##
==========================================
+ Coverage   74.36%   74.44%   +0.08%     
==========================================
  Files          66       67       +1     
  Lines        4486     4512      +26     
  Branches      756      760       +4     
==========================================
+ Hits         3336     3359      +23     
- Misses        970      972       +2     
- Partials      180      181       +1     
Flag Coverage Δ
unittests 74.44% <76.92%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nanodet/model/backbone/__init__.py 93.10% <66.66%> (+0.79%) ⬆️
nanodet/model/backbone/timm_wrapper.py 78.26% <78.26%> (ø)
nanodet/data/transform/warp.py 85.63% <0.00%> (+1.14%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@RangiLyu RangiLyu merged commit 9795110 into main Aug 26, 2022
@RangiLyu RangiLyu deleted the timm_backbone branch January 20, 2023 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support of several backbones with NanoDet-Plus architecture
1 participant