readme: ---
  tags:
  - image-classification
  - timm
  library_tag: timm
  license: cc-by-nc-4.0
  datasets:
  - imagenet-1k
  - imagenet-1k
  ---
  # Model card for convnextv2_base.fcmae_ft_in22k_in1k_384
  
  A ConvNeXt-V2 image classification model. Pretrained with a fully convolutional masked autoencoder framework (FCMAE) and fine-tuned on ImageNet-22k and then ImageNet-1k.
  
  ## Model Details
  - **Model Type:** Image classification / feature backbone
  - **Model Stats:**
    - Params (M): 88.7
    - GMACs: 45.2
    - Activations (M): 84.5
    - Image size: 384 x 384
  - **Papers:**
    - ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders: https://arxiv.org/abs/2301.00808
  - **Original:** https://github.com/facebookresearch/ConvNeXt-V2
  - **Dataset:** ImageNet-1k
  - **Pretrain Dataset:** ImageNet-1k
  
  ## Model Usage
  ### Image Classification
  ```python
  from urllib.request import urlopen
  from PIL import Image
  import timm
  
  img = Image.open(
      urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
  
  model = timm.create_model('convnextv2_base.fcmae_ft_in22k_in1k_384', pretrained=True)
  model = model.eval()
  
  # get model specific transforms (normalization, resize)
  data_config = timm.data.resolve_model_data_config(model)
  transforms = timm.data.create_transform(**data_config, is_training=False)
  
  output = model(transforms(img).unsqueeze(0))  # unsqueeze single image into batch of 1
  
  top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
  ```
  
  ### Feature Map Extraction
  ```python
  from urllib.request import urlopen
  from PIL import Image
  import timm
  
  img = Image.open(
      urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
  
  model = timm.create_model(
      'convnextv2_base.fcmae_ft_in22k_in1k_384',
      pretrained=True,
      features_only=True,
  )
  model = model.eval()
  
  # get model specific transforms (normalization, resize)
  data_config = timm.data.resolve_model_data_config(model)
  transforms = timm.data.create_transform(**data_config, is_training=False)
  
  output = model(transforms(img).unsqueeze(0))  # unsqueeze single image into batch of 1
  
  for o in output:
      # print shape of each feature map in output
      # e.g. for convnext_base: 
      #  torch.Size([1, 128, 56, 56])
      #  torch.Size([1, 256, 28, 28])
      #  torch.Size([1, 512, 14, 14])
      #  torch.Size([1, 1024, 7, 7]) 
      print(o.shape)
  ```
  
  ### Image Embeddings
  ```python
  from urllib.request import urlopen
  from PIL import Image
  import timm
  
  img = Image.open(
      urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
  
  model = timm.create_model(
      'convnextv2_base.fcmae_ft_in22k_in1k_384',
      pretrained=True,
      num_classes=0,  # remove classifier nn.Linear
  )
  model = model.eval()
  
  # get model specific transforms (normalization, resize)
  data_config = timm.data.resolve_model_data_config(model)
  transforms = timm.data.create_transform(**data_config, is_training=False)
  
  output = model(transforms(img).unsqueeze(0))  # output is (batch_size, num_features) shaped tensor
  
  # or equivalently (without needing to set num_classes=0)
  
  output = model.forward_features(transforms(img).unsqueeze(0))
  # output is unpooled (ie.e a (batch_size, num_features, H, W) tensor
  
  output = model.forward_head(output, pre_logits=True)
  # output is (batch_size, num_features) tensor
  ```
  
  ## Model Comparison
  ### By Top-1
  All timing numbers from eager model PyTorch 1.13 on RTX 3090 w/ AMP.
  
  |model                                         |top1  |top5  |img_size|param_count|gmacs |macts |samples_per_sec|batch_size|
  |----------------------------------------------|------|------|--------|-----------|------|------|---------------|----------|
  |[convnextv2_huge.fcmae_ft_in22k_in1k_512](https://huggingface.co/timm/convnextv2_huge.fcmae_ft_in22k_in1k_512)|88.848|98.742|512     |660.29     |600.81|413.07|28.58          |48        |
  |[convnextv2_huge.fcmae_ft_in22k_in1k_384](https://huggingface.co/timm/convnextv2_huge.fcmae_ft_in22k_in1k_384)|88.668|98.738|384     |660.29     |337.96|232.35|50.56          |64        |
  |[convnextv2_large.fcmae_ft_in22k_in1k_384](https://huggingface.co/timm/convnextv2_large.fcmae_ft_in22k_in1k_384)|88.196|98.532|384     |197.96     |101.1 |126.74|128.94         |128       |
  |[convnext_xlarge.fb_in22k_ft_in1k_384](https://huggingface.co/timm/convnext_xlarge.fb_in22k_ft_in1k_384)|87.75 |98.556|384     |350.2      |179.2 |168.99|124.85         |192       |
  |[convnextv2_base.fcmae_ft_in22k_in1k_384](https://huggingface.co/timm/convnextv2_base.fcmae_ft_in22k_in1k_384)|87.646|98.422|384     |88.72      |45.21 |84.49 |209.51         |256       |
  |[convnext_large.fb_in22k_ft_in1k_384](https://huggingface.co/timm/convnext_large.fb_in22k_ft_in1k_384)|87.476|98.382|384     |197.77     |101.1 |126.74|194.66         |256       |
  |[convnext_large_mlp.clip_laion2b_augreg_ft_in1k](https://huggingface.co/timm/convnext_larg