@@ -34,7 +34,7 @@ def _load_state_dict(model: nn.Module, weights: Weights, progress: bool) -> None
3434 r"^(.*denselayer\d+\.(?:norm|relu|conv))\.((?:[12])\.(?:weight|bias|running_mean|running_var))$"
3535 )
3636
37- state_dict = weights .state_dict (progress = progress )
37+ state_dict = weights .get_state_dict (progress = progress )
3838 for key in list (state_dict .keys ()):
3939 res = pattern .match (key )
4040 if res :
@@ -63,11 +63,11 @@ def _densenet(
6363 return model
6464
6565
66- _common_meta = {
66+ _COMMON_META = {
6767 "size" : (224 , 224 ),
6868 "categories" : _IMAGENET_CATEGORIES ,
6969 "interpolation" : InterpolationMode .BILINEAR ,
70- "recipe" : None , # weights ported from LuaTorch
70+ "recipe" : None , # TODO: add here a URL to documentation stating that the weights were ported from LuaTorch
7171}
7272
7373
@@ -76,7 +76,7 @@ class DenseNet121Weights(Weights):
7676 url = "https://download.pytorch.org/models/densenet121-a639ec97.pth" ,
7777 transforms = partial (ImageNetEval , crop_size = 224 ),
7878 meta = {
79- ** _common_meta ,
79+ ** _COMMON_META ,
8080 "acc@1" : 74.434 ,
8181 "acc@5" : 91.972 ,
8282 },
@@ -88,7 +88,7 @@ class DenseNet161Weights(Weights):
8888 url = "https://download.pytorch.org/models/densenet161-8d451a50.pth" ,
8989 transforms = partial (ImageNetEval , crop_size = 224 ),
9090 meta = {
91- ** _common_meta ,
91+ ** _COMMON_META ,
9292 "acc@1" : 77.138 ,
9393 "acc@5" : 93.560 ,
9494 },
@@ -100,7 +100,7 @@ class DenseNet169Weights(Weights):
100100 url = "https://download.pytorch.org/models/densenet169-b2777c0a.pth" ,
101101 transforms = partial (ImageNetEval , crop_size = 224 ),
102102 meta = {
103- ** _common_meta ,
103+ ** _COMMON_META ,
104104 "acc@1" : 75.600 ,
105105 "acc@5" : 92.806 ,
106106 },
@@ -112,7 +112,7 @@ class DenseNet201Weights(Weights):
112112 url = "https://download.pytorch.org/models/densenet201-c1103571.pth" ,
113113 transforms = partial (ImageNetEval , crop_size = 224 ),
114114 meta = {
115- ** _common_meta ,
115+ ** _COMMON_META ,
116116 "acc@1" : 76.896 ,
117117 "acc@5" : 93.370 ,
118118 },
@@ -121,7 +121,7 @@ class DenseNet201Weights(Weights):
121121
122122def densenet121 (weights : Optional [DenseNet121Weights ] = None , progress : bool = True , ** kwargs : Any ) -> DenseNet :
123123 if "pretrained" in kwargs :
124- warnings .warn ("The argument pretrained is deprecated, please use weights instead." )
124+ warnings .warn ("The parameter pretrained is deprecated, please use weights instead." )
125125 weights = DenseNet121Weights .ImageNet1K_Community if kwargs .pop ("pretrained" ) else None
126126 weights = DenseNet121Weights .verify (weights )
127127
@@ -130,7 +130,7 @@ def densenet121(weights: Optional[DenseNet121Weights] = None, progress: bool = T
130130
131131def densenet161 (weights : Optional [DenseNet161Weights ] = None , progress : bool = True , ** kwargs : Any ) -> DenseNet :
132132 if "pretrained" in kwargs :
133- warnings .warn ("The argument pretrained is deprecated, please use weights instead." )
133+ warnings .warn ("The parameter pretrained is deprecated, please use weights instead." )
134134 weights = DenseNet161Weights .ImageNet1K_Community if kwargs .pop ("pretrained" ) else None
135135 weights = DenseNet161Weights .verify (weights )
136136
@@ -139,7 +139,7 @@ def densenet161(weights: Optional[DenseNet161Weights] = None, progress: bool = T
139139
140140def densenet169 (weights : Optional [DenseNet169Weights ] = None , progress : bool = True , ** kwargs : Any ) -> DenseNet :
141141 if "pretrained" in kwargs :
142- warnings .warn ("The argument pretrained is deprecated, please use weights instead." )
142+ warnings .warn ("The parameter pretrained is deprecated, please use weights instead." )
143143 weights = DenseNet169Weights .ImageNet1K_Community if kwargs .pop ("pretrained" ) else None
144144 weights = DenseNet169Weights .verify (weights )
145145
@@ -148,7 +148,7 @@ def densenet169(weights: Optional[DenseNet169Weights] = None, progress: bool = T
148148
149149def densenet201 (weights : Optional [DenseNet201Weights ] = None , progress : bool = True , ** kwargs : Any ) -> DenseNet :
150150 if "pretrained" in kwargs :
151- warnings .warn ("The argument pretrained is deprecated, please use weights instead." )
151+ warnings .warn ("The parameter pretrained is deprecated, please use weights instead." )
152152 weights = DenseNet201Weights .ImageNet1K_Community if kwargs .pop ("pretrained" ) else None
153153 weights = DenseNet201Weights .verify (weights )
154154
0 commit comments