mobilenet_v2¶
- torchvision.models.mobilenet_v2(*, weights: Optional[MobileNet_V2_Weights] = None, progress: bool = True, **kwargs: Any) MobileNetV2 [原始碼]¶
來自 MobileNetV2: Inverted Residuals and Linear Bottlenecks 論文的 MobileNetV2 架構。
- 參數:
weights (
MobileNet_V2_Weights
, optional) – 要使用的預訓練權重。請參閱下方的MobileNet_V2_Weights
了解更多細節和可能的值。預設情況下,不使用任何預訓練權重。progress (bool, optional) – 如果為 True,則在 stderr 中顯示下載的進度列。預設值為 True。
**kwargs – 傳遞給
torchvision.models.mobilenetv2.MobileNetV2
基底類別的參數。請參考 原始碼 以了解更多關於此類別的細節。
- class torchvision.models.MobileNet_V2_Weights(value)[原始碼]¶
上面的模型建構器接受以下值作為
weights
參數。MobileNet_V2_Weights.DEFAULT
等同於MobileNet_V2_Weights.IMAGENET1K_V2
。您也可以使用字串,例如weights='DEFAULT'
或weights='IMAGENET1K_V1'
。MobileNet_V2_Weights.IMAGENET1K_V1:
這些權重使用簡單的訓練方法,能夠重現論文中的結果。
acc@1 (在 ImageNet-1K 上)
71.878
acc@5 (在 ImageNet-1K 上)
90.286
num_params (參數數量)
3504872
min_size (最小尺寸)
height=1, width=1 (高=1, 寬=1)
categories (類別)
tench, goldfish, great white shark, … (省略 997 個)
recipe (方法)
GFLOPS
0.30
File size (檔案大小)
13.6 MB
推理轉換可於
MobileNet_V2_Weights.IMAGENET1K_V1.transforms
取得,並執行以下預處理操作:接受PIL.Image
、批次(B, C, H, W)
和單張(C, H, W)
圖片torch.Tensor
物件。圖片會被縮放至resize_size=[256]
,使用interpolation=InterpolationMode.BILINEAR
,然後進行中心裁剪至crop_size=[224]
。最後,這些值會先縮放至[0.0, 1.0]
,然後使用mean=[0.485, 0.456, 0.406]
和std=[0.229, 0.224, 0.225]
進行正規化。MobileNet_V2_Weights.IMAGENET1K_V2:
這些權重透過使用 TorchVision 修改後的 新訓練方法,改善了原始論文的結果。也可以使用
MobileNet_V2_Weights.DEFAULT
。acc@1 (在 ImageNet-1K 上)
72.154
acc@5 (在 ImageNet-1K 上)
90.822
num_params (參數數量)
3504872
min_size (最小尺寸)
height=1, width=1 (高=1, 寬=1)
categories (類別)
tench, goldfish, great white shark, … (省略 997 個)
recipe (方法)
GFLOPS
0.30
File size (檔案大小)
13.6 MB
推理轉換可於
MobileNet_V2_Weights.IMAGENET1K_V2.transforms
取得,並執行以下預處理操作:接受PIL.Image
、批次(B, C, H, W)
和單張(C, H, W)
圖片torch.Tensor
物件。圖片會被縮放至resize_size=[232]
,使用interpolation=InterpolationMode.BILINEAR
,然後進行中心裁剪至crop_size=[224]
。最後,這些值會先縮放至[0.0, 1.0]
,然後使用mean=[0.485, 0.456, 0.406]
和std=[0.229, 0.224, 0.225]
進行正規化。