neuromeka-vfm 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
@@ -26,6 +26,25 @@ class Segmentation:
26
26
  self.call_time = {"add_image_prompt": 0, "register_first_frame": 0, "get_next": 0}
27
27
  self.call_count = {"add_image_prompt": 0, "register_first_frame": 0, "get_next": 0}
28
28
 
29
+ def _is_success(self, response):
30
+ """
31
+ Normalize server success flag.
32
+ Some servers return {"result": "SUCCESS"}, others {"success": true}, and
33
+ the segmentation server returns {"status": "success"}.
34
+ """
35
+ # Try known keys in order of common usage.
36
+ for key in ("result", "success", "status"):
37
+ flag = response.get(key)
38
+ if flag is None:
39
+ continue
40
+ if isinstance(flag, str):
41
+ return flag.lower() == "success"
42
+ if isinstance(flag, bool):
43
+ return flag
44
+ return bool(flag)
45
+ # Fallback: anything truthy counts as success.
46
+ return bool(response)
47
+
29
48
  def switch_compression_strategy(self, compression_strategy):
30
49
  if compression_strategy in STRATEGIES:
31
50
  self.compression_strategy_name = compression_strategy
@@ -46,7 +65,7 @@ class Segmentation:
46
65
  start = time.time()
47
66
  data = {"operation": "add_image_prompt", "object_name": object_name, "object_image": object_image}
48
67
  response = self.client.send_data(data)
49
- if response.get("result") == "SUCCESS":
68
+ if self._is_success(response):
50
69
  self.image_prompt_names.add(object_name)
51
70
  if self.benchmark:
52
71
  self.call_time["add_image_prompt"] += time.time() - start
@@ -72,7 +91,7 @@ class Segmentation:
72
91
  "compression_strategy": self.compression_strategy_name,
73
92
  }
74
93
  response = self.client.send_data(data)
75
- if response.get("result") == "SUCCESS":
94
+ if self._is_success(response):
76
95
  self.first_frame_registered = True
77
96
  self.tracking_object_ids = response["data"]["obj_ids"]
78
97
  masks = {}
@@ -98,7 +117,7 @@ class Segmentation:
98
117
  if self.benchmark:
99
118
  start = time.time()
100
119
  response = self.client.send_data({"operation": "get_next", "frame": self.compression_strategy.encode(frame)})
101
- if response.get("result") == "SUCCESS":
120
+ if self._is_success(response):
102
121
  masks = {}
103
122
  for i, obj_id in enumerate(self.tracking_object_ids):
104
123
  mask = self.compression_strategy.decode(response["data"]["masks"][i])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuromeka_vfm
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Client utilities for Neuromeka VFM FoundationPose RPC (upload meshes, call server)
5
5
  Author: Neuromeka
6
6
  License: MIT License
@@ -2,13 +2,13 @@ neuromeka_vfm/__init__.py,sha256=h5ODdWFgN7a9TBzF6Qfdyx5VxUr2hG0pFTwq57jEvDo,422
2
2
  neuromeka_vfm/compression.py,sha256=d2xOz4XBJZ60pPSXwQ5LPYwhpsaNORvNoY_0CUiAvt0,5191
3
3
  neuromeka_vfm/pickle_client.py,sha256=Iw2fpxdnKB20oEUgsd0rJlvzOd5JhetphpKkF9qQcX0,591
4
4
  neuromeka_vfm/pose_estimation.py,sha256=3MUVhL0nMcpHApZDAzutS7fINPHcb-tu_WoXvNGU33E,2625
5
- neuromeka_vfm/segmentation.py,sha256=PKOJiNoZz8tlwSX-eAgvqA2YWKkcCkKcoQfaiIEqCdU,5630
5
+ neuromeka_vfm/segmentation.py,sha256=wae0_m225DUMD8Nm2A7iQm49QWeUas17B8PaoGGFt5w,6311
6
6
  neuromeka_vfm/upload_mesh.py,sha256=aW5G9aE5OeiDN5pEVKDzMeV538U-I2iRYZvVZTfGsr4,2728
7
7
  neuromeka_vfm/examples/__init__.py,sha256=dEhb0FqhpEGNmg0pMunmrTlViIcxvd95fYEjZ49IOTQ,37
8
8
  neuromeka_vfm/examples/pose_demo.py,sha256=zq1Z0_kxQc4CB-ltfwm_oMoC7JLoN5GyeE3C6jKGQKw,13658
9
- neuromeka_vfm-0.1.2.dist-info/licenses/LICENSE,sha256=40cBWxFahhu0p_EB0GhU8oVIifVNmH1o2fZtx0bIif8,1076
10
- neuromeka_vfm-0.1.2.dist-info/METADATA,sha256=MxiWRP0T5iZzHMsHqyIXSX9JZQF0Kv2dGBhzyOT6EMc,7372
11
- neuromeka_vfm-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- neuromeka_vfm-0.1.2.dist-info/entry_points.txt,sha256=Wl4XqiUt_GLQ08oTJtsYjLW0iYxZ52ysVd1-cN0kYP4,72
13
- neuromeka_vfm-0.1.2.dist-info/top_level.txt,sha256=uAH_yXikUvxXTSEnUC0M8Zl5ggxbnkYtXlmTfEG8MUk,14
14
- neuromeka_vfm-0.1.2.dist-info/RECORD,,
9
+ neuromeka_vfm-0.1.3.dist-info/licenses/LICENSE,sha256=40cBWxFahhu0p_EB0GhU8oVIifVNmH1o2fZtx0bIif8,1076
10
+ neuromeka_vfm-0.1.3.dist-info/METADATA,sha256=iHvDBzm7K5TqsP13HDSSpJB1o-XL0TJ4Yl77_ueCQac,7372
11
+ neuromeka_vfm-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ neuromeka_vfm-0.1.3.dist-info/entry_points.txt,sha256=Wl4XqiUt_GLQ08oTJtsYjLW0iYxZ52ysVd1-cN0kYP4,72
13
+ neuromeka_vfm-0.1.3.dist-info/top_level.txt,sha256=uAH_yXikUvxXTSEnUC0M8Zl5ggxbnkYtXlmTfEG8MUk,14
14
+ neuromeka_vfm-0.1.3.dist-info/RECORD,,