Skip to content

Commit 72a9d9e

Browse files
No public description
PiperOrigin-RevId: 817361653
1 parent af463db commit 72a9d9e

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

  • official/projects/waste_identification_ml/llm_applications/milk_pouch_detection

official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ frames.
1212

1313
### 1. Create a VM Instance
1414

15+
Many VM configurations will work, but the specs [here](/circularnet-docs/content/deploy-cn/before-you-begin.md) are relevant.
16+
1517
### 2. Download the Setup Script
1618

17-
SSH into your VM instance and run:
19+
SSH into your VM instance. If this is the first access, you will be prompted
20+
to install nVidia drivers. After this is complete, run:
1821

1922
```bash
2023
curl -o setup.sh https://raw.githubusercontent.com/tensorflow/models/master/official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/setup.sh

official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/setup.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/bin/bash
22
#
3-
# This script sets up the complete environment for a computer vision project.
3+
# This script sets up the complete environment for a computer vision project
4+
# using a model ensemble approach of bounding box detection, segmentation,
5+
# and classification. The classification model is a pre-trained VIT model.
6+
7+
# The script performs the following steps:
48
# It performs the following steps:
59
# 1. Installs system-level dependencies.
610
# 2. Creates a Python virtual environment.
711
# 3. Installs PyTorch, GroundingDINO, SAM2, and other Python packages.
812
# 4. Creates project directories and downloads required model checkpoints.
9-
# 5. Installs, configures, and starts the Ollama service.
10-
# 6. Pulls a specific LLM model for use with Ollama.
13+
# 5. Fetches the custom trained VIT classifier model.
14+
# 6. Fetches the scripts to run the pipeline.
1115

1216
# Exit immediately if a command exits with a non-zero status.
1317
set -o errexit
@@ -18,8 +22,7 @@ set -o pipefail
1822

1923
# --- 1. Install System Dependencies ---
2024
echo "🔹 Starting: Install System Dependencies"
21-
sudo apt-get update -qq -y > /dev/null 2>&1
22-
sudo apt-get install -qq -y python3-venv python3-pip lsof > /dev/null 2>&1
25+
sudo apt-get install -y python3-venv python3-pip lsof
2326
echo "✅ Finished: Install System Dependencies"
2427
echo "-----"
2528

@@ -33,22 +36,22 @@ echo "-----"
3336
# --- 3. Install Compatible Torch version ---
3437
echo "🔹 Starting: Install Torch, Torchvision, Torchaudio"
3538
pip uninstall -y torch torchvision torchaudio > /dev/null 2>&1 || true
36-
pip install --quiet torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
39+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
3740
echo "✅ Finished: Install Torch, Torchvision, Torchaudio"
3841
echo "-----"
3942

4043
# --- 4. Install Grounding DINO ---
4144
echo "🔹 Starting: Install Grounding DINO"
42-
git clone --quiet https://github.com/IDEA-Research/GroundingDINO.git
45+
git clone https://github.com/IDEA-Research/GroundingDINO.git
4346
cd GroundingDINO
44-
pip install --quiet -e .
47+
pip install -e .
4548
cd ..
4649
echo "✅ Finished: Install Grounding DINO"
4750
echo "-----"
4851

4952
# --- 5. Install SAM2 and Required Packages ---
5053
echo "🔹 Starting: Install SAM2 and Required Python Packages"
51-
pip install --quiet --no-cache-dir \
54+
pip install --no-cache-dir \
5255
opencv-python \
5356
numpy \
5457
ollama \
@@ -69,18 +72,18 @@ echo "-----"
6972

7073
# --- 7. Download Model Checkpoints ---
7174
echo "🔹 Starting: Download SAM2 Checkpoint"
72-
wget -q -P ./milk_pouch_project/sam2_model https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt
75+
wget -P ./milk_pouch_project/sam2_model https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt
7376
echo "✅ Finished: Download SAM2 Checkpoint"
7477
echo "-----"
7578

7679
echo "🔹 Starting: Download GroundingDINO Model and Config"
77-
wget -q -P ./milk_pouch_project/grounding_dino_model https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
78-
wget -q -P ./milk_pouch_project/grounding_dino_model https://raw.githubusercontent.com/IDEA-Research/GroundingDINO/refs/heads/main/groundingdino/config/GroundingDINO_SwinT_OGC.py
80+
wget -P ./milk_pouch_project/grounding_dino_model https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
81+
wget -P ./milk_pouch_project/grounding_dino_model https://raw.githubusercontent.com/IDEA-Research/GroundingDINO/refs/heads/main/groundingdino/config/GroundingDINO_SwinT_OGC.py
7982
echo "✅ Finished: Download GroundingDINO Model and Config"
8083
echo "-----"
8184

8285
echo "🔹 Starting: Download Image Classifier Model"
83-
wget -q -P ./milk_pouch_project/image_classifier_model https://storage.googleapis.com/tf_model_garden/vision/waste_identification_ml/dairy_product_packet_detection/best_vit_model_epoch_131.pt
86+
wget -P ./milk_pouch_project/image_classifier_model https://storage.googleapis.com/tf_model_garden/vision/waste_identification_ml/dairy_product_packet_detection/best_vit_model_epoch_131.pt
8487
echo "✅ Finished: Download Image Classifier Model"
8588
echo "-----"
8689

0 commit comments

Comments
 (0)