download_ckpts.sh 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # Copyright (c) Meta Platforms, Inc. and affiliates.
  3. # All rights reserved.
  4. # This source code is licensed under the license found in the
  5. # LICENSE file in the root directory of this source tree.
  6. # Define the URLs for the checkpoints
  7. BASE_URL="https://dl.fbaipublicfiles.com/segment_anything_2/072824/"
  8. sam2_hiera_t_url="${BASE_URL}sam2_hiera_tiny.pt"
  9. sam2_hiera_s_url="${BASE_URL}sam2_hiera_small.pt"
  10. sam2_hiera_b_plus_url="${BASE_URL}sam2_hiera_base_plus.pt"
  11. sam2_hiera_l_url="${BASE_URL}sam2_hiera_large.pt"
  12. # Download each of the four checkpoints using wget
  13. echo "Downloading sam2_hiera_tiny.pt checkpoint..."
  14. wget $sam2_hiera_t_url || { echo "Failed to download checkpoint from $sam2_hiera_t_url"; exit 1; }
  15. echo "Downloading sam2_hiera_small.pt checkpoint..."
  16. wget $sam2_hiera_s_url || { echo "Failed to download checkpoint from $sam2_hiera_s_url"; exit 1; }
  17. echo "Downloading sam2_hiera_base_plus.pt checkpoint..."
  18. wget $sam2_hiera_b_plus_url || { echo "Failed to download checkpoint from $sam2_hiera_b_plus_url"; exit 1; }
  19. echo "Downloading sam2_hiera_large.pt checkpoint..."
  20. wget $sam2_hiera_l_url || { echo "Failed to download checkpoint from $sam2_hiera_l_url"; exit 1; }
  21. echo "All checkpoints are downloaded successfully."