Tutorial - NanoSAM
Let's run NVIDIA's NanoSAM to check out the performance gain by distillation.
What you need
-
One of the following Jetson:
Jetson AGX Orin (64GB) Jetson AGX Orin (32GB) Jetson Orin NX (16GB) Jetson Orin Nano (8GB)
-
Running one of the following versions of JetPack :
JetPack 5 (L4T r35.x) JetPack 6 (L4T r36.x)
-
Sufficient storage space (preferably with NVMe SSD).
-
6.3GB
for container image - Spaces for models
-
-
Clone and setup
jetson-containers
:git clone https://github.com/dusty-nv/jetson-containers bash jetson-containers/install.sh
How to start
Use the
jetson-containers run
and
autotag
commands to automatically pull or build a compatible container image.
jetson-containers run $(autotag nanosam)
Run examples
Inside the container, you can move to
/opt/nanosam
directory, to go through all the examples demonstrated on the repo.
cd /opt/nanosam
To run the " Example 1 - Segment with bounding box ":
python3 examples/basic_usage.py \
--image_encoder="data/resnet18_image_encoder.engine" \
--mask_decoder="data/mobile_sam_mask_decoder.engine"
The result is saved under
/opt/nanosam/data/basic_usage_out.jpg
.
To check on your host machine, you can copy that into
/data
directory of the container where that is mounted from the host.
cp data/basic_usage_out.jpg /data/
Then you can go to your host system, and find the file under
jetson-containers/data/basic_usage_out.jpg
Results