@@ -221,7 +221,7 @@ way of doing it:
221
221
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
222
222
223
223
# load a model pre-trained on COCO
224
- model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained = True )
224
+ model = torchvision.models.detection.fasterrcnn_resnet50_fpn(weights = " DEFAULT " )
225
225
226
226
# replace the classifier with a new one, that has
227
227
# num_classes which is user-defined
@@ -242,7 +242,7 @@ way of doing it:
242
242
243
243
# load a pre-trained model for classification and return
244
244
# only the features
245
- backbone = torchvision.models.mobilenet_v2(pretrained = True ).features
245
+ backbone = torchvision.models.mobilenet_v2(weights = " DEFAULT " ).features
246
246
# FasterRCNN needs to know the number of
247
247
# output channels in a backbone. For mobilenet_v2, it's 1280
248
248
# so we need to add it here
@@ -291,7 +291,7 @@ be using Mask R-CNN:
291
291
292
292
def get_model_instance_segmentation (num_classes ):
293
293
# load an instance segmentation model pre-trained on COCO
294
- model = torchvision.models.detection.maskrcnn_resnet50_fpn(pretrained = True )
294
+ model = torchvision.models.detection.maskrcnn_resnet50_fpn(weights = " DEFAULT " )
295
295
296
296
# get number of input features for the classifier
297
297
in_features = model.roi_heads.box_predictor.cls_score.in_features
@@ -344,7 +344,7 @@ expects during training and inference time on sample data.
344
344
345
345
.. code :: python
346
346
347
- model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained = True )
347
+ model = torchvision.models.detection.fasterrcnn_resnet50_fpn(weights = " DEFAULT " )
348
348
dataset = PennFudanDataset(' PennFudanPed' , get_transform(train = True ))
349
349
data_loader = torch.utils.data.DataLoader(
350
350
dataset, batch_size = 2 , shuffle = True , num_workers = 4 ,
0 commit comments