File size: 603 Bytes
6307f85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

MODELS_DIR="models"
mkdir -p ${MODELS_DIR}

download_model() {
  FILE_PATH="${MODELS_DIR}/$1"
  URL="$2"

  if [ ! -f "${FILE_PATH}" ]; then
    wget -q "${URL}" -P ${MODELS_DIR}/
  fi
}

# Model files and their corresponding URLs
declare -A MODELS
# We just run with MobileSAM for this example
# MODELS["sam_vit_h_4b8939.pth"]="https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth"
MODELS["mobile_sam.pt"]="https://github.com/ChaoningZhang/MobileSAM/raw/master/weights/mobile_sam.pt"

for model in "${!MODELS[@]}"; do
  download_model "${model}" "${MODELS[${model}]}"
done