ultralytics 8.3.59 Add ability to load any torchvision model as module (#18564)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
246c3eca81
commit
cc1e77138c
8 changed files with 104 additions and 2 deletions
|
|
@ -50,6 +50,7 @@ from ultralytics.nn.modules import (
|
|||
HGBlock,
|
||||
HGStem,
|
||||
ImagePoolingAttn,
|
||||
Index,
|
||||
Pose,
|
||||
RepC3,
|
||||
RepConv,
|
||||
|
|
@ -59,6 +60,7 @@ from ultralytics.nn.modules import (
|
|||
RTDETRDecoder,
|
||||
SCDown,
|
||||
Segment,
|
||||
TorchVision,
|
||||
WorldDetect,
|
||||
v10Detect,
|
||||
)
|
||||
|
|
@ -1052,7 +1054,7 @@ def parse_model(d, ch, verbose=True): # model_dict, input_channels(3)
|
|||
m.legacy = legacy
|
||||
elif m is RTDETRDecoder: # special case, channels arg must be passed in index 1
|
||||
args.insert(1, [ch[x] for x in f])
|
||||
elif m is CBLinear:
|
||||
elif m in {CBLinear, TorchVision, Index}:
|
||||
c2 = args[0]
|
||||
c1 = ch[f]
|
||||
args = [c1, c2, *args[1:]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue