Skip to content

Best parameters for BoQ-ResNet50 #7

@guipotje

Description

@guipotje

Hello @amaralibey, thank you for the amazing framework, the code is pretty easy to use!

I'm training a BoQ-ResNet-50 with the following parameters, for obtaining a 4096 descriptor dim. After 40 epochs, I'm obtaining slightly worse results than expected from BoQ repository README. Is there any parameter you recommend to adjust for some improvement? I reduced batch size to 64 to fit in my GPU, do you believe this may be the reason for reduced performance?

image

# ----------------------------------------------------------------------------
# Copyright (c) 2024 Amar Ali-bey
# # https://github.com/amaralibey/OpenVPRLab
# Licensed under the MIT License. See LICENSE file in the project root.
# ----------------------------------------------------------------------------


#---------------------------------------------------
# Datamodule Configuration
#---------------------------------------------------
datamodule:
  train_set_name: "gsv-cities" # use "gsv-cities" if you have downloaded the full dataset
  train_image_size: 
    - 320
    - 320
  val_image_size: 
    - 384
    - 384
  img_per_place: 4
  batch_size: 64
  num_workers: 8
  val_set_names:
    - "msls-val"
    - "pitts30k-val"

#---------------------------------------------------
# VPR Model Configuration
#---------------------------------------------------
backbone:
  module: src.models.backbones
  class: ResNet
  params:
    backbone_name: "resnet50"  # name of the resnet backbone (see ResNet.AVAILABLE_MODELS)
    pretrained: true
    num_unfrozen_blocks: 2
    crop_last_block: true
  
  # Example of DinoV2
  # name: dinov2
  # module: src.models.backbones
  # class: DinoV2
  # params:
  #   backbone_name: "dinov2_vitb14" # name of the vit backbone (see DinoV2.AVAILABLE_MODELS)
  #   num_unfrozen_blocks: 2

aggregator:
  module: src.models.aggregators # module path
  class: BoQ    # class name in the __init__.py file in the aggregators directory
  params:
    in_channels:  # if left blank we will use backbone.out_channels.
    proj_channels: 256
    num_queries: 32
    num_layers: 2
    row_dim: 16

#---------------------------------------------------
# Loss Function Configuration
#---------------------------------------------------
loss_function: 
  # check src/losses/vpr_losses.py for available loss functions, we are using pytorch_metric_learning library
  # if you want to develop your own loss function, you can add it to the vpr_losses.py file
  # or create a new file in the losses directory and import it into the __inin__.py file
  module: src.losses
  class: VPRLossFunction
  params:
    loss_fn_name: "MultiSimilarityLoss"   # other possible values: "SupConLoss", "ContrastiveLoss", "TripletMarginLoss"
    miner_name: "MultiSimilarityMiner"    # other possible values: "TripletMarginMiner", "PairMarginMiner"


#---------------------------------------------------
# Trainer Configuration
#---------------------------------------------------
trainer:
  optimizer: adamw
  lr: 0.0004      # learning rate
  wd: 0.001       # weight decay
  warmup: 1500    # linear warmup steps
  max_epochs: 40
  milestones:
    - 5
    - 10
    - 20
    - 30
  lr_mult: 0.25 # learning rate multiplier at each milestone

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions