Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Added error msg if freeze_at = 5 but body has 4 blocks #738

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion detectron/modeling/ResNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def add_ResNet_convX_body(model, block_counts):
The final res5/conv5 stage may be optionally excluded (hence convX, where
X = 4 or 5)."""
freeze_at = cfg.TRAIN.FREEZE_AT
assert freeze_at in [0, 2, 3, 4, 5]
if len(block_counts) == 4:
assert freeze_at in [0, 2, 3, 4, 5]
else:
assert freeze_at in [0, 2, 3, 4] # if the body does not have res5, freeze_at cannot be 5

# add the stem (by default, conv1 and pool1 with bn; can support gn)
p, dim_in = globals()[cfg.RESNETS.STEM_FUNC](model, 'data')
Expand Down