neuromeka-vfm 0.1.3__tar.gz → 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. neuromeka_vfm-0.1.5/PKG-INFO +285 -0
  2. neuromeka_vfm-0.1.5/README.md +238 -0
  3. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/pyproject.toml +3 -2
  4. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/__init__.py +2 -0
  5. neuromeka_vfm-0.1.5/src/neuromeka_vfm/grasp_gen.py +79 -0
  6. neuromeka_vfm-0.1.5/src/neuromeka_vfm/point_cloud_utils.py +377 -0
  7. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/segmentation.py +54 -0
  8. neuromeka_vfm-0.1.5/src/neuromeka_vfm.egg-info/PKG-INFO +285 -0
  9. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm.egg-info/SOURCES.txt +2 -0
  10. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm.egg-info/requires.txt +2 -1
  11. neuromeka_vfm-0.1.3/PKG-INFO +0 -159
  12. neuromeka_vfm-0.1.3/README.md +0 -113
  13. neuromeka_vfm-0.1.3/src/neuromeka_vfm.egg-info/PKG-INFO +0 -159
  14. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/LICENSE +0 -0
  15. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/setup.cfg +0 -0
  16. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/compression.py +0 -0
  17. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/examples/__init__.py +0 -0
  18. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/examples/pose_demo.py +0 -0
  19. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/pickle_client.py +0 -0
  20. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/pose_estimation.py +0 -0
  21. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm/upload_mesh.py +0 -0
  22. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm.egg-info/dependency_links.txt +0 -0
  23. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm.egg-info/entry_points.txt +0 -0
  24. {neuromeka_vfm-0.1.3 → neuromeka_vfm-0.1.5}/src/neuromeka_vfm.egg-info/top_level.txt +0 -0
@@ -0,0 +1,285 @@
1
+ Metadata-Version: 2.4
2
+ Name: neuromeka_vfm
3
+ Version: 0.1.5
4
+ Summary: Client utilities for Neuromeka VFM FoundationPose RPC (upload meshes, call server)
5
+ Author: Neuromeka
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Neuromeka Co., Ltd.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Classifier: Development Status :: 3 - Alpha
29
+ Classifier: Intended Audience :: Developers
30
+ Classifier: License :: OSI Approved :: MIT License
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: Programming Language :: Python :: 3.8
33
+ Classifier: Programming Language :: Python :: 3.9
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Requires-Python: >=3.8
38
+ Description-Content-Type: text/markdown
39
+ License-File: LICENSE
40
+ Requires-Dist: numpy
41
+ Requires-Dist: pyzmq
42
+ Requires-Dist: paramiko
43
+ Requires-Dist: av
44
+ Requires-Dist: trimesh
45
+ Requires-Dist: tqdm
46
+ Dynamic: license-file
47
+
48
+ # neuromeka_vfm
49
+
50
+ 클라이언트 PC에서 Segmentation (SAM2, Grounding DINO), Pose Estimation (NVIDIA FoundationPose) 서버(RPC, ZeroMQ)와 통신하고, SSH/SFTP로 호스트에 mesh를 업로드하는 간단한 유틸 패키지입니다.
51
+
52
+ - Website: http://www.neuromeka.com
53
+ - Source code: https://github.com/neuromeka-robotics/neuromeka_vfm
54
+ - PyPI package: https://pypi.org/project/neuromeka_vfm/
55
+ - Documents: https://docs.neuromeka.com
56
+
57
+ ## Web UI (VFM Tester)를 통해 사용 가능
58
+
59
+ - VFM Tester (Web UI): https://gitlab.com/neuromeka-group/nrmkq/nrmk_vfm_tester
60
+
61
+
62
+ ## Installation
63
+ ```bash
64
+ pip install neuromeka_vfm
65
+ ```
66
+
67
+ ## Python API (예제로 보는 사용법)
68
+
69
+ * 내 PC: 어플리케이션을 구현하고 이 패키지 (neuromeka_vfm)이 설치된 PC
70
+ * 서버PC (Host): Segmentation, Pose Estimation 도커 서버가 설치된 PC. 내 PC에 도커를 설치할 경우 localhost 사용.
71
+
72
+ ### Segmentation
73
+ ```python
74
+ from neuromeka_vfm import Segmentation
75
+
76
+ seg = Segmentation(
77
+ hostname="192.168.10.63",
78
+ port=5432,
79
+ compression_strategy="png", # none | png | jpeg | h264
80
+ )
81
+
82
+ # Image Prompt를 이용한 등록
83
+ seg.add_image_prompt("drug_box", ref_rgb)
84
+ seg.register_first_frame(frame=first_rgb,
85
+ prompt="drug_box", # ID str
86
+ use_image_prompt=True)
87
+
88
+ # Text Prompt를 이용한 등록
89
+ seg.register_first_frame(frame=first_rgb,
90
+ prompt="box .", # Text prompt (끝에 띄어쓰기 . 필수)
91
+ use_image_prompt=False)
92
+
93
+ # 등록된 mask에 대한 SAM2 tracking
94
+ resp = seg.get_next(next_rgb)
95
+ if isinstance(resp, dict) and resp.get("result") == "ERROR":
96
+ print(f"Tracking error: {resp.get('message')}")
97
+ seg.reset()
98
+ else:
99
+ masks = resp
100
+
101
+ # Segmentation 설정/모델 선택 (nrmk_realtime_segmentation v0.2+)
102
+ caps = seg.get_capabilities()["data"]
103
+ current = seg.get_config()["data"]
104
+ seg.set_config(
105
+ {
106
+ "grounding_dino": {
107
+ "backbone": "Swin-B", # Swin-T | Swin-B
108
+ "box_threshold": 0.35,
109
+ "text_threshold": 0.25,
110
+ },
111
+ "dino_detection": {
112
+ "threshold": 0.5,
113
+ "target_multiplier": 25,
114
+ "img_multiplier": 50,
115
+ "background_threshold": -1.0,
116
+ "final_erosion_count": 10,
117
+ "segment_min_size": 20,
118
+ },
119
+ "sam2": {
120
+ "model": "facebook/sam2.1-hiera-large",
121
+ "use_legacy": False,
122
+ "compile": False,
123
+ "offload_state_to_cpu": False,
124
+ "offload_video_to_cpu": False,
125
+ },
126
+ }
127
+ )
128
+
129
+ # SAM2 object 제거 (v0.2+, use_legacy=False에서만 지원)
130
+ seg.remove_object("cup_0")
131
+
132
+
133
+ seg.close()
134
+ ```
135
+
136
+ #### Segmentation v0.2 설정 요약 (defaults/choices)
137
+ `seg.get_capabilities()` 결과는 서버 설정에 따라 달라질 수 있습니다. 아래는 v0.2 기본값입니다.
138
+ ```yaml
139
+ grounding_dino:
140
+ backbone:
141
+ choices:
142
+ - Swin-B
143
+ - Swin-T
144
+ default: Swin-T
145
+ box_threshold:
146
+ default: 0.35
147
+ min: 0.0
148
+ max: 1.0
149
+ text_threshold:
150
+ default: 0.25
151
+ min: 0.0
152
+ max: 1.0
153
+
154
+ dino_detection:
155
+ threshold:
156
+ default: 0.5
157
+ target_multiplier:
158
+ default: 25
159
+ img_multiplier:
160
+ default: 50
161
+ background_threshold:
162
+ default: -1.0
163
+ final_erosion_count:
164
+ default: 10
165
+ segment_min_size:
166
+ default: 20
167
+
168
+ sam2:
169
+ model:
170
+ choices:
171
+ - facebook/sam2-hiera-base-plus
172
+ - facebook/sam2-hiera-large
173
+ - facebook/sam2-hiera-small
174
+ - facebook/sam2-hiera-tiny
175
+ - facebook/sam2.1-hiera-base-plus
176
+ - facebook/sam2.1-hiera-large
177
+ - facebook/sam2.1-hiera-small
178
+ - facebook/sam2.1-hiera-tiny
179
+ default: facebook/sam2.1-hiera-large
180
+ use_legacy:
181
+ default: false
182
+ compile:
183
+ default: false
184
+ offload_state_to_cpu:
185
+ default: false
186
+ offload_video_to_cpu:
187
+ default: false
188
+ ```
189
+
190
+ #### Segmentation v0.2 주의사항/변경사항
191
+ - SAM2 VRAM 추정 실패 시 `seg.get_next()`가 `{"result":"ERROR"}`로 반환될 수 있으니 에러 처리 후 `reset`/재등록을 권장합니다.
192
+ - SAM2 `compile=True`는 첫 프레임 등록 및 `reset`이 느려질 수 있습니다.
193
+ - SAM2 CPU offloading은 `offload_state_to_cpu=True`와 `offload_video_to_cpu=True`를 함께 설정할 때 효과가 큽니다(legacy 모드에서는 `offload_video_to_cpu` 미지원).
194
+ - SAM2 `remove_object`는 `use_legacy=False`에서만 지원됩니다.
195
+ - GroundingDINO는 Swin-B 백본이 추가되었고, 프롬프트 토큰 병합 이슈가 수정되었습니다.
196
+
197
+ ### Pose Estimation
198
+
199
+ **Mesh 파일 업로드**: 등록/인식하고자 하는 mesh 파일 (stl)을 호스트PC의 '/opt/meshes/' 경로에 업로드 (직접 SSH 통해 파일을 옮겨도 됨)
200
+ ```python
201
+ from neuromeka_vfm import upload_mesh
202
+ upload_mesh(
203
+ host="192.168.10.63",
204
+ user="user",
205
+ password="pass",
206
+ local="mesh/my_mesh.stl", # 내 PC mesh 경로
207
+ remote="/opt/meshes/my_mesh.stl", # 호스트PC mesh 경로 (도커 볼륨마운트)
208
+ )
209
+ ```
210
+
211
+ 초기화
212
+ ```python
213
+ from neuromeka_vfm import PoseEstimation
214
+
215
+ pose = PoseEstimation(host="192.168.10.72", port=5557)
216
+
217
+ pose.init(
218
+ mesh_path="/app/modules/foundation_pose/mesh/my_mesh.stl",
219
+ apply_scale=1.0,
220
+ track_refine_iter=3,
221
+ min_n_views=40,
222
+ inplane_step=60
223
+ )
224
+ ```
225
+ - mesh_path: 사용할 물체 메시 파일(STL/OBJ 등) 경로. 없으면 초기화 실패.
226
+ - apply_scale: 메시를 로드한 뒤 전체를 배율 조정하는 스케일 값. 단위 없는 곱셈 계수.
227
+ - STL 모델이 미터 단위라면 1.0 (스케일 없음)
228
+ - STL 모델이 센티미터 단위라면 0.01 (1 cm → 0.01 m)
229
+ - STL 모델이 밀리미터 단위라면 0.001 (1 mm → 0.001 m)
230
+ - force_apply_color: True일 때 메시에 단색 텍스처를 강제로 입힘. 메시가 색상을 안 가졌을 때 시각화 안정성을 위해 사용.
231
+ - apply_color: force_apply_color가 True일 때 적용할 RGB 색상값(0~255) 튜플.
232
+ - est_refine_iter: 초기 등록(register) 단계에서 포즈를 반복 정련하는 횟수. 값이 클수록 정확도 ↑, 연산 시간 ↑.
233
+ - track_refine_iter: 추적(track) 단계에서 한 프레임당 포즈 정련 반복 횟수.
234
+ - min_n_views: 초기 뷰 샘플링 시 생성할 최소 카메라 뷰 수(회전 후보 수에 영향).
235
+ - inplane_step: in-plane 회전 샘플링 간격(도 단위). 값이 작을수록 더 많은 회전 후보를 생성.
236
+
237
+
238
+ 인식 및 추적
239
+ ```python
240
+ # 초기 등록 (iteration 생략 시 서버 기본값, check_vram=True로 VRAM 사전 체크)
241
+ register_resp = pose.register(rgb=rgb0, depth=depth0, mask=mask0, K=cam_K, check_vram=True)
242
+
243
+ # 추적 (bbox_xywh로 탐색 범위 제한 가능)
244
+ track_resp = pose.track(rgb=rgb1, depth=depth1, K=cam_K, bbox_xywh=bbox_xywh)
245
+ pose.close()
246
+ ```
247
+ - cam_K: camera intrinsic
248
+ - RGB resolution이 크거나, min_n_views 값이 크거나, inplane_step이 작을 경우 GPU VRAM 초과 에러 발생.
249
+ - register check_vram=True 일 경우 VRAM 초과 사전 검사하여 shutdown 방지.
250
+
251
+
252
+ ## VFM (Vision Foundation Model) latency benchmark
253
+ 로컬 서버 구동 시 측정. 빈칸은 아직 미측정 항목입니다.
254
+
255
+ **RTX 5060**
256
+ | Task | Prompt | None (s) | JPEG (s) | PNG (s) | h264 (s) |
257
+ | --- | --- | --- | --- | --- | --- |
258
+ | Grounding DINO | text (human . cup .) | 0.86 | 0.35 | 0.50 | 0.52 |
259
+ | DINOv2 | image prompt | 0.85 | 0.49 | 0.65 | 0.63 |
260
+ | SAM2 | - | | | | |
261
+ | FoundationPose registration | - | | | | |
262
+ | FoundationPose track | - | | | | |
263
+
264
+ **RTX 5090**
265
+ | Task | Prompt | None (s) | JPEG (s) | PNG (s) | h264 (s) |
266
+ | --- | --- | --- | --- | --- | --- |
267
+ | Grounding DINO | text (human . cup .) | | | | |
268
+ | DINOv2 | image prompt | | | | |
269
+ | SAM2 | - | | | | |
270
+ | FoundationPose registration | - | 0.4 | - | | |
271
+ | FoundationPose track | - | 0.03 | | | |
272
+
273
+ **Jetson Orin**
274
+ | Task | Prompt | None (s) | JPEG (s) | PNG (s) | h264 (s) |
275
+ | --- | --- | --- | --- | --- | --- |
276
+ | Grounding DINO | text (human . cup .) | | | | |
277
+ | DINOv2 | image prompt | | | | |
278
+ | SAM2 | - | | | | |
279
+ | FoundationPose registration | - | 0.4 | - | | |
280
+ | FoundationPose track | - | 0.03 | | | |
281
+
282
+ ## 릴리스 노트
283
+ - 0.1.2: Segmentation 응답 성공 판정 개선(`result`/`success`/`status` 모두 지원), image prompt 등록/사용 오류 수정, PoseEstimation `register`에 `check_vram` 옵션 반영.
284
+ - 0.1.1: PoseEstimation/Segmentation에서 리소스 정리 개선, iteration 미전달 시 서버 기본값 사용, pose 데모 예제 추가.
285
+ - 0.1.0: 초기 공개 버전. FoundationPose RPC 클라이언트, 실시간 세그멘테이션 클라이언트, SSH 기반 mesh 업로드 CLI/API 포함.
@@ -0,0 +1,238 @@
1
+ # neuromeka_vfm
2
+
3
+ 클라이언트 PC에서 Segmentation (SAM2, Grounding DINO), Pose Estimation (NVIDIA FoundationPose) 서버(RPC, ZeroMQ)와 통신하고, SSH/SFTP로 호스트에 mesh를 업로드하는 간단한 유틸 패키지입니다.
4
+
5
+ - Website: http://www.neuromeka.com
6
+ - Source code: https://github.com/neuromeka-robotics/neuromeka_vfm
7
+ - PyPI package: https://pypi.org/project/neuromeka_vfm/
8
+ - Documents: https://docs.neuromeka.com
9
+
10
+ ## Web UI (VFM Tester)를 통해 사용 가능
11
+
12
+ - VFM Tester (Web UI): https://gitlab.com/neuromeka-group/nrmkq/nrmk_vfm_tester
13
+
14
+
15
+ ## Installation
16
+ ```bash
17
+ pip install neuromeka_vfm
18
+ ```
19
+
20
+ ## Python API (예제로 보는 사용법)
21
+
22
+ * 내 PC: 어플리케이션을 구현하고 이 패키지 (neuromeka_vfm)이 설치된 PC
23
+ * 서버PC (Host): Segmentation, Pose Estimation 도커 서버가 설치된 PC. 내 PC에 도커를 설치할 경우 localhost 사용.
24
+
25
+ ### Segmentation
26
+ ```python
27
+ from neuromeka_vfm import Segmentation
28
+
29
+ seg = Segmentation(
30
+ hostname="192.168.10.63",
31
+ port=5432,
32
+ compression_strategy="png", # none | png | jpeg | h264
33
+ )
34
+
35
+ # Image Prompt를 이용한 등록
36
+ seg.add_image_prompt("drug_box", ref_rgb)
37
+ seg.register_first_frame(frame=first_rgb,
38
+ prompt="drug_box", # ID str
39
+ use_image_prompt=True)
40
+
41
+ # Text Prompt를 이용한 등록
42
+ seg.register_first_frame(frame=first_rgb,
43
+ prompt="box .", # Text prompt (끝에 띄어쓰기 . 필수)
44
+ use_image_prompt=False)
45
+
46
+ # 등록된 mask에 대한 SAM2 tracking
47
+ resp = seg.get_next(next_rgb)
48
+ if isinstance(resp, dict) and resp.get("result") == "ERROR":
49
+ print(f"Tracking error: {resp.get('message')}")
50
+ seg.reset()
51
+ else:
52
+ masks = resp
53
+
54
+ # Segmentation 설정/모델 선택 (nrmk_realtime_segmentation v0.2+)
55
+ caps = seg.get_capabilities()["data"]
56
+ current = seg.get_config()["data"]
57
+ seg.set_config(
58
+ {
59
+ "grounding_dino": {
60
+ "backbone": "Swin-B", # Swin-T | Swin-B
61
+ "box_threshold": 0.35,
62
+ "text_threshold": 0.25,
63
+ },
64
+ "dino_detection": {
65
+ "threshold": 0.5,
66
+ "target_multiplier": 25,
67
+ "img_multiplier": 50,
68
+ "background_threshold": -1.0,
69
+ "final_erosion_count": 10,
70
+ "segment_min_size": 20,
71
+ },
72
+ "sam2": {
73
+ "model": "facebook/sam2.1-hiera-large",
74
+ "use_legacy": False,
75
+ "compile": False,
76
+ "offload_state_to_cpu": False,
77
+ "offload_video_to_cpu": False,
78
+ },
79
+ }
80
+ )
81
+
82
+ # SAM2 object 제거 (v0.2+, use_legacy=False에서만 지원)
83
+ seg.remove_object("cup_0")
84
+
85
+
86
+ seg.close()
87
+ ```
88
+
89
+ #### Segmentation v0.2 설정 요약 (defaults/choices)
90
+ `seg.get_capabilities()` 결과는 서버 설정에 따라 달라질 수 있습니다. 아래는 v0.2 기본값입니다.
91
+ ```yaml
92
+ grounding_dino:
93
+ backbone:
94
+ choices:
95
+ - Swin-B
96
+ - Swin-T
97
+ default: Swin-T
98
+ box_threshold:
99
+ default: 0.35
100
+ min: 0.0
101
+ max: 1.0
102
+ text_threshold:
103
+ default: 0.25
104
+ min: 0.0
105
+ max: 1.0
106
+
107
+ dino_detection:
108
+ threshold:
109
+ default: 0.5
110
+ target_multiplier:
111
+ default: 25
112
+ img_multiplier:
113
+ default: 50
114
+ background_threshold:
115
+ default: -1.0
116
+ final_erosion_count:
117
+ default: 10
118
+ segment_min_size:
119
+ default: 20
120
+
121
+ sam2:
122
+ model:
123
+ choices:
124
+ - facebook/sam2-hiera-base-plus
125
+ - facebook/sam2-hiera-large
126
+ - facebook/sam2-hiera-small
127
+ - facebook/sam2-hiera-tiny
128
+ - facebook/sam2.1-hiera-base-plus
129
+ - facebook/sam2.1-hiera-large
130
+ - facebook/sam2.1-hiera-small
131
+ - facebook/sam2.1-hiera-tiny
132
+ default: facebook/sam2.1-hiera-large
133
+ use_legacy:
134
+ default: false
135
+ compile:
136
+ default: false
137
+ offload_state_to_cpu:
138
+ default: false
139
+ offload_video_to_cpu:
140
+ default: false
141
+ ```
142
+
143
+ #### Segmentation v0.2 주의사항/변경사항
144
+ - SAM2 VRAM 추정 실패 시 `seg.get_next()`가 `{"result":"ERROR"}`로 반환될 수 있으니 에러 처리 후 `reset`/재등록을 권장합니다.
145
+ - SAM2 `compile=True`는 첫 프레임 등록 및 `reset`이 느려질 수 있습니다.
146
+ - SAM2 CPU offloading은 `offload_state_to_cpu=True`와 `offload_video_to_cpu=True`를 함께 설정할 때 효과가 큽니다(legacy 모드에서는 `offload_video_to_cpu` 미지원).
147
+ - SAM2 `remove_object`는 `use_legacy=False`에서만 지원됩니다.
148
+ - GroundingDINO는 Swin-B 백본이 추가되었고, 프롬프트 토큰 병합 이슈가 수정되었습니다.
149
+
150
+ ### Pose Estimation
151
+
152
+ **Mesh 파일 업로드**: 등록/인식하고자 하는 mesh 파일 (stl)을 호스트PC의 '/opt/meshes/' 경로에 업로드 (직접 SSH 통해 파일을 옮겨도 됨)
153
+ ```python
154
+ from neuromeka_vfm import upload_mesh
155
+ upload_mesh(
156
+ host="192.168.10.63",
157
+ user="user",
158
+ password="pass",
159
+ local="mesh/my_mesh.stl", # 내 PC mesh 경로
160
+ remote="/opt/meshes/my_mesh.stl", # 호스트PC mesh 경로 (도커 볼륨마운트)
161
+ )
162
+ ```
163
+
164
+ 초기화
165
+ ```python
166
+ from neuromeka_vfm import PoseEstimation
167
+
168
+ pose = PoseEstimation(host="192.168.10.72", port=5557)
169
+
170
+ pose.init(
171
+ mesh_path="/app/modules/foundation_pose/mesh/my_mesh.stl",
172
+ apply_scale=1.0,
173
+ track_refine_iter=3,
174
+ min_n_views=40,
175
+ inplane_step=60
176
+ )
177
+ ```
178
+ - mesh_path: 사용할 물체 메시 파일(STL/OBJ 등) 경로. 없으면 초기화 실패.
179
+ - apply_scale: 메시를 로드한 뒤 전체를 배율 조정하는 스케일 값. 단위 없는 곱셈 계수.
180
+ - STL 모델이 미터 단위라면 1.0 (스케일 없음)
181
+ - STL 모델이 센티미터 단위라면 0.01 (1 cm → 0.01 m)
182
+ - STL 모델이 밀리미터 단위라면 0.001 (1 mm → 0.001 m)
183
+ - force_apply_color: True일 때 메시에 단색 텍스처를 강제로 입힘. 메시가 색상을 안 가졌을 때 시각화 안정성을 위해 사용.
184
+ - apply_color: force_apply_color가 True일 때 적용할 RGB 색상값(0~255) 튜플.
185
+ - est_refine_iter: 초기 등록(register) 단계에서 포즈를 반복 정련하는 횟수. 값이 클수록 정확도 ↑, 연산 시간 ↑.
186
+ - track_refine_iter: 추적(track) 단계에서 한 프레임당 포즈 정련 반복 횟수.
187
+ - min_n_views: 초기 뷰 샘플링 시 생성할 최소 카메라 뷰 수(회전 후보 수에 영향).
188
+ - inplane_step: in-plane 회전 샘플링 간격(도 단위). 값이 작을수록 더 많은 회전 후보를 생성.
189
+
190
+
191
+ 인식 및 추적
192
+ ```python
193
+ # 초기 등록 (iteration 생략 시 서버 기본값, check_vram=True로 VRAM 사전 체크)
194
+ register_resp = pose.register(rgb=rgb0, depth=depth0, mask=mask0, K=cam_K, check_vram=True)
195
+
196
+ # 추적 (bbox_xywh로 탐색 범위 제한 가능)
197
+ track_resp = pose.track(rgb=rgb1, depth=depth1, K=cam_K, bbox_xywh=bbox_xywh)
198
+ pose.close()
199
+ ```
200
+ - cam_K: camera intrinsic
201
+ - RGB resolution이 크거나, min_n_views 값이 크거나, inplane_step이 작을 경우 GPU VRAM 초과 에러 발생.
202
+ - register check_vram=True 일 경우 VRAM 초과 사전 검사하여 shutdown 방지.
203
+
204
+
205
+ ## VFM (Vision Foundation Model) latency benchmark
206
+ 로컬 서버 구동 시 측정. 빈칸은 아직 미측정 항목입니다.
207
+
208
+ **RTX 5060**
209
+ | Task | Prompt | None (s) | JPEG (s) | PNG (s) | h264 (s) |
210
+ | --- | --- | --- | --- | --- | --- |
211
+ | Grounding DINO | text (human . cup .) | 0.86 | 0.35 | 0.50 | 0.52 |
212
+ | DINOv2 | image prompt | 0.85 | 0.49 | 0.65 | 0.63 |
213
+ | SAM2 | - | | | | |
214
+ | FoundationPose registration | - | | | | |
215
+ | FoundationPose track | - | | | | |
216
+
217
+ **RTX 5090**
218
+ | Task | Prompt | None (s) | JPEG (s) | PNG (s) | h264 (s) |
219
+ | --- | --- | --- | --- | --- | --- |
220
+ | Grounding DINO | text (human . cup .) | | | | |
221
+ | DINOv2 | image prompt | | | | |
222
+ | SAM2 | - | | | | |
223
+ | FoundationPose registration | - | 0.4 | - | | |
224
+ | FoundationPose track | - | 0.03 | | | |
225
+
226
+ **Jetson Orin**
227
+ | Task | Prompt | None (s) | JPEG (s) | PNG (s) | h264 (s) |
228
+ | --- | --- | --- | --- | --- | --- |
229
+ | Grounding DINO | text (human . cup .) | | | | |
230
+ | DINOv2 | image prompt | | | | |
231
+ | SAM2 | - | | | | |
232
+ | FoundationPose registration | - | 0.4 | - | | |
233
+ | FoundationPose track | - | 0.03 | | | |
234
+
235
+ ## 릴리스 노트
236
+ - 0.1.2: Segmentation 응답 성공 판정 개선(`result`/`success`/`status` 모두 지원), image prompt 등록/사용 오류 수정, PoseEstimation `register`에 `check_vram` 옵션 반영.
237
+ - 0.1.1: PoseEstimation/Segmentation에서 리소스 정리 개선, iteration 미전달 시 서버 기본값 사용, pose 데모 예제 추가.
238
+ - 0.1.0: 초기 공개 버전. FoundationPose RPC 클라이언트, 실시간 세그멘테이션 클라이언트, SSH 기반 mesh 업로드 CLI/API 포함.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neuromeka_vfm"
7
- version = "0.1.3"
7
+ version = "0.1.5"
8
8
  description = "Client utilities for Neuromeka VFM FoundationPose RPC (upload meshes, call server)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -14,7 +14,8 @@ dependencies = [
14
14
  "pyzmq",
15
15
  "paramiko",
16
16
  "av",
17
- "opencv-python-headless",
17
+ "trimesh",
18
+ "tqdm",
18
19
  ]
19
20
  authors = [{name = "Neuromeka"}]
20
21
  classifiers = [
@@ -2,6 +2,7 @@ from .pose_estimation import PoseEstimation, FoundationPoseClient
2
2
  from .upload_mesh import upload_mesh
3
3
  from .segmentation import Segmentation, NrmkRealtimeSegmentation
4
4
  from .compression import STRATEGIES as SEGMENTATION_COMPRESSION_STRATEGIES
5
+ from .grasp_gen import GraspPoseGeneration
5
6
 
6
7
  __all__ = [
7
8
  "PoseEstimation",
@@ -10,4 +11,5 @@ __all__ = [
10
11
  "Segmentation",
11
12
  "NrmkRealtimeSegmentation",
12
13
  "SEGMENTATION_COMPRESSION_STRATEGIES",
14
+ "GraspPoseGeneration",
13
15
  ]
@@ -0,0 +1,79 @@
1
+ from typing import Tuple
2
+
3
+ import numpy as np
4
+ import trimesh
5
+
6
+ from . import point_cloud_utils
7
+
8
+
9
+ class GraspPoseGeneration:
10
+ """
11
+ Wrapper class for point cloud utilities used in grasp pose workflows.
12
+ """
13
+
14
+ def knn_points(self, X: np.ndarray, K: int, norm: int):
15
+ return point_cloud_utils.knn_points(X=X, K=K, norm=norm)
16
+
17
+ def point_cloud_outlier_removal(
18
+ self, obj_pc: np.ndarray, threshold: float = 0.014, K: int = 20
19
+ ) -> Tuple[np.ndarray, np.ndarray]:
20
+ return point_cloud_utils.point_cloud_outlier_removal(
21
+ obj_pc=obj_pc, threshold=threshold, K=K
22
+ )
23
+
24
+ def point_cloud_outlier_removal_with_color(
25
+ self,
26
+ obj_pc: np.ndarray,
27
+ obj_pc_color: np.ndarray,
28
+ threshold: float = 0.014,
29
+ K: int = 20,
30
+ ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
31
+ return point_cloud_utils.point_cloud_outlier_removal_with_color(
32
+ obj_pc=obj_pc,
33
+ obj_pc_color=obj_pc_color,
34
+ threshold=threshold,
35
+ K=K,
36
+ )
37
+
38
+ def depth_and_segmentation_to_point_clouds(
39
+ self,
40
+ depth_image: np.ndarray,
41
+ segmentation_mask: np.ndarray,
42
+ fx: float,
43
+ fy: float,
44
+ cx: float,
45
+ cy: float,
46
+ rgb_image: np.ndarray = None,
47
+ target_object_id: int = 1,
48
+ remove_object_from_scene: bool = False,
49
+ ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
50
+ return point_cloud_utils.depth_and_segmentation_to_point_clouds(
51
+ depth_image=depth_image,
52
+ segmentation_mask=segmentation_mask,
53
+ fx=fx,
54
+ fy=fy,
55
+ cx=cx,
56
+ cy=cy,
57
+ rgb_image=rgb_image,
58
+ target_object_id=target_object_id,
59
+ remove_object_from_scene=remove_object_from_scene,
60
+ )
61
+
62
+ def filter_colliding_grasps(
63
+ self,
64
+ scene_pc: np.ndarray,
65
+ grasp_poses: np.ndarray,
66
+ gripper_collision_mesh: trimesh.Trimesh,
67
+ collision_threshold: float = 0.002,
68
+ num_collision_samples: int = 2000,
69
+ ) -> np.ndarray:
70
+ return point_cloud_utils.filter_colliding_grasps(
71
+ scene_pc=scene_pc,
72
+ grasp_poses=grasp_poses,
73
+ gripper_collision_mesh=gripper_collision_mesh,
74
+ collision_threshold=collision_threshold,
75
+ num_collision_samples=num_collision_samples,
76
+ )
77
+
78
+
79
+ __all__ = ["GraspPoseGeneration"]