File size: 5,095 Bytes
e15abf5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# FoundationPose Setup Guide

**Quick navigation to setup instructions:**

## 🎯 Choose Your Path

### Path 1: Test Without Weights (5 minutes)

Just want to test the API structure?

```bash
cd foundationpose
pip install -r requirements.txt
python app.py
```

✅ Works immediately
✅ No GPU needed
✅ Returns valid API responses (empty results)
✅ Perfect for developing client integrations

→ **No additional setup needed!**

---

### Path 2: Deploy with Real Weights (30 minutes)

Want actual 6D pose estimation?

**Step 1: Get Model Weights**

Option A: **Create HF Model Repo** (Recommended)
📖 **Guide:** [HF_MODEL_SETUP.md](HF_MODEL_SETUP.md) (Quick 5-min guide)
📖 **Detailed:** [UPLOAD_WEIGHTS.md](UPLOAD_WEIGHTS.md) (Full instructions)

```bash
# Quick version:
huggingface-cli login
huggingface-cli repo create foundationpose-weights --type model
huggingface-cli upload YOUR_USER/foundationpose-weights ./weights .
```

Option B: Manual Download (Not recommended)
- Download from Google Drive
- Use git-lfs to add to Space repo
- More complex, slower

**Step 2: Configure Space**

Add environment variables in Space settings:
```
FOUNDATIONPOSE_MODEL_REPO=YOUR_USER/foundationpose-weights
USE_HF_WEIGHTS=true
USE_REAL_MODEL=true
```

**Step 3: Deploy**

```bash
git push origin main
```

Done! Space will auto-download weights on first run.

---

## 📚 Documentation Index

| Document | Purpose | Read When |
|----------|---------|-----------|
| [HF_MODEL_SETUP.md](HF_MODEL_SETUP.md) | **Quick HF model repo setup** | Setting up weights (recommended way) |
| [UPLOAD_WEIGHTS.md](UPLOAD_WEIGHTS.md) | Detailed weight upload guide | Need step-by-step instructions |
| [QUICKSTART.md](QUICKSTART.md) | API usage & integration | Ready to use the API |
| [DEPLOYMENT.md](DEPLOYMENT.md) | Full deployment options | Want all the details |
| [STATUS.md](STATUS.md) | Complete project status | Want to know what's done/missing |
| [README.md](README.md) | Space homepage | First-time visitors |

---

## 🚀 Deployment Options Summary

### A. Placeholder Mode (Default)

```bash
# No setup needed
git push origin main
```

- Returns empty results
- Tests API structure
- No GPU costs
- Perfect for development

### B. Real Mode (Automatic Download)

```bash
# 1. Upload weights to HF model repo (see HF_MODEL_SETUP.md)
# 2. Set Space environment variables:
#    FOUNDATIONPOSE_MODEL_REPO=YOUR_USER/foundationpose-weights
#    USE_HF_WEIGHTS=true
#    USE_REAL_MODEL=true
# 3. Deploy
git push origin main
```

- Automatic weight download
- Real pose estimation
- ZeroGPU inference
- Production-ready

### C. Real Mode (Manual Weights)

```bash
# 1. Download weights manually
# 2. Add with git-lfs
git lfs track "weights/**"
git add weights/
git commit -m "Add weights"
# 3. Set USE_REAL_MODEL=true
git push origin main
```

- Weights included in Space
- Slower deployments
- Larger Space size
- Not recommended

---

## 🔗 Integration with robot-ml

Once your Space is running:

**1. Update wrapper:**
```python
from foundationpose.client import FoundationPoseClient

client = FoundationPoseClient("https://YOUR_USER-foundationpose.hf.space")
```

**2. Update config:**
```yaml
perception:
  enabled: true
  model: foundation_pose
  api_url: https://YOUR_USER-foundationpose.hf.space
```

**Full integration code:** See [QUICKSTART.md](QUICKSTART.md#integration-with-robot-ml)

---

## ❓ FAQ

**Q: Do I need a GPU?**
A: No. ZeroGPU allocates GPU on-demand when needed.

**Q: How much does it cost?**
A: ZeroGPU is free with usage limits. Placeholder mode uses no GPU.

**Q: Can I use someone else's weights?**
A: Yes! If someone has a public model repo: `FOUNDATIONPOSE_MODEL_REPO=their-username/foundationpose-weights`

**Q: How big are the weights?**
A: ~1.8GB total (900MB refiner + 900MB scorer)

**Q: Where do I get the weights?**
A: Download from [Google Drive](https://drive.google.com/drive/folders/1GCyGE-LbFGgRC-FuGsF3a1zeBuzsQ1Da) then upload to HF model repo.

**Q: Can I test locally?**
A: Yes! `python test_local.py` tests everything locally first.

**Q: What if weight download fails?**
A: Space will run in placeholder mode automatically. Check logs for errors.

---

## 🎯 Recommended Workflow

```
1. Test locally first
   → python test_local.py

2. Deploy placeholder mode
   → Test Space works

3. Create HF model repo
   → Upload weights
   → See HF_MODEL_SETUP.md

4. Enable real mode
   → Set environment variables
   → Space auto-downloads weights

5. Integrate with robot-ml
   → See QUICKSTART.md
```

---

## 🆘 Getting Help

- **General questions:** See [QUICKSTART.md](QUICKSTART.md)
- **Deployment issues:** See [DEPLOYMENT.md](DEPLOYMENT.md)
- **Weight upload:** See [UPLOAD_WEIGHTS.md](UPLOAD_WEIGHTS.md) or [HF_MODEL_SETUP.md](HF_MODEL_SETUP.md)
- **Project status:** See [STATUS.md](STATUS.md)
- **API usage:** See [QUICKSTART.md](QUICKSTART.md)

---

**Start here:**
→ Test locally: `python test_local.py`
→ Want real weights: [HF_MODEL_SETUP.md](HF_MODEL_SETUP.md)
→ Deploy: `git push origin main`

That's it! 🎉