Skip to content

Conversation

@datumbox
Copy link
Contributor

@datumbox datumbox commented Nov 6, 2021

Fixes partially #4675

Verified that both commands return the same:

torchrun --nproc_per_node=1 train.py --test-only --pretrained --model ssd300_vgg16

torchrun --nproc_per_node=1 train.py --test-only --weights Coco_RefV1 --model ssd300_vgg16

cc @datumbox @bjuncek

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Nov 6, 2021

💊 CI failures summary and remediations

As of commit 19bb0f7 (more details on the Dr. CI page):


  • 1/1 failures introduced in this PR

1 failure not recognized by patterns:

Job Step Action
CircleCI binary_libtorchvision_ops_android Build 🔁 rerun

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Copy link
Contributor Author

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding few comments to assist review:

weights = SSD300VGG16Weights.verify(weights)
if "pretrained_backbone" in kwargs:
warnings.warn("The argument pretrained_backbone is deprecated, please use weights_backbone instead.")
weights_backbone = VGG16Weights.ImageNet1K_Features if kwargs.pop("pretrained_backbone") else None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using special weights here. Not the standard VGG weights of TorchVision.

"image_mean": [0.48235, 0.45882, 0.40784],
"image_std": [1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0], # undo the 0-1 scaling of toTensor
}
kwargs: Any = {**defaults, **kwargs}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any type declaration needed to mypy.

# We port the features of a VGG16 backbone trained by amdegroot because unlike the one on TorchVision, it uses the
# same input standardization method as the paper. Only the `features` weights have proper values, those on the
# `classifier` module are filled with nans.
ImageNet1K_Features = WeightEntry(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are adding the weights as a separate entry on the VGG. This one only has the features part of the model.

"interpolation": InterpolationMode.BILINEAR,
"recipe": "https://github.com/amdegroot/ssd.pytorch#training-ssd",
"acc@1": float("nan"),
"acc@5": float("nan"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't contain a classifier, hence the nans here to denote it.

@datumbox datumbox linked an issue Nov 6, 2021 that may be closed by this pull request
6 tasks
Copy link
Contributor

@jdsgomes jdsgomes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left a minor comment for consideration

"image_std": [1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0], # undo the 0-1 scaling of toTensor
}
kwargs: Any = {**defaults, **kwargs}
model = SSD(backbone, anchor_generator, (300, 300), num_classes, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we get the size from the weights?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same discussion as in #4875 (comment).

Note that unlike the FasterRCNN models that adapt better on variable input size, SSD doesn't. It was investigated at #3819 and that's why it's hardcoded.

Copy link
Contributor

@jdsgomes jdsgomes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@datumbox datumbox merged commit 0c68a6d into pytorch:main Nov 8, 2021
@datumbox datumbox deleted the prototype/ssd_multiweight branch November 8, 2021 11:20
facebook-github-bot pushed a commit that referenced this pull request Nov 15, 2021
Reviewed By: datumbox

Differential Revision: D32298973

fbshipit-source-id: e74e8cfc564f13681466a4006a3a879731b597ec
cyyever pushed a commit to cyyever/vision that referenced this pull request Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-pretrained weights: Add model builders for Detection

3 participants