synapse-sdk 1.0.0a35__py3-none-any.whl → 1.0.0a36__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.
Potentially problematic release.
This version of synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/clients/agent/core.py +4 -0
- synapse_sdk/plugins/categories/neural_net/templates/config.yaml +10 -2
- synapse_sdk/utils/dataset.py +46 -0
- synapse_sdk/utils/storage/__init__.py +30 -0
- synapse_sdk/utils/storage/providers/__init__.py +30 -0
- synapse_sdk/utils/storage/providers/s3.py +35 -0
- synapse_sdk/utils/storage/providers/sftp.py +31 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-1.0.0a36.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-1.0.0a36.dist-info}/RECORD +13 -12
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-1.0.0a36.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-1.0.0a36.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-1.0.0a36.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0a35.dist-info → synapse_sdk-1.0.0a36.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
name: plugin_name
|
|
2
|
+
code: plugin_code
|
|
3
|
+
version: plugin_version
|
|
4
|
+
readme: README.md
|
|
5
|
+
description: This is plugin_name plugin
|
|
6
|
+
category: neural_net
|
|
7
|
+
tasks:
|
|
8
|
+
- object_detection
|
|
2
9
|
data_type: image
|
|
10
|
+
package_manager: uv
|
|
3
11
|
actions:
|
|
4
12
|
train:
|
|
5
13
|
dataset: dataset
|
|
@@ -18,4 +26,4 @@ actions:
|
|
|
18
26
|
endpoints:
|
|
19
27
|
- method: get
|
|
20
28
|
test:
|
|
21
|
-
entrypoint: plugin.test.test
|
|
29
|
+
entrypoint: plugin.test.test
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def remap_class_labels(dataset, data_type, class_pattern, new_class):
|
|
5
|
+
"""
|
|
6
|
+
Remaps class labels in a dataset by replacing specific classification patterns.
|
|
7
|
+
|
|
8
|
+
This function finds items of a specified data type (e.g., 'pcd', 'image', 'video')
|
|
9
|
+
where the classification matches a given pattern (e.g., 'truck', 'car'), and
|
|
10
|
+
remaps them to a new class label (e.g., 'vehicle'). Useful for consolidating
|
|
11
|
+
or standardizing class labels in ground truth data.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
dataset (dict): The dataset containing ground truth labels
|
|
15
|
+
data_type (str): Type of data to process (e.g., 'pcd', 'image', 'video')
|
|
16
|
+
class_pattern (dict): Pattern to identify target classifications (e.g., {'name': 'truck'})
|
|
17
|
+
new_class (dict): New classification to apply (e.g., {'name': 'vehicle'})
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
dict: Dataset with remapped class labels
|
|
21
|
+
"""
|
|
22
|
+
updated_dataset = dataset.copy()
|
|
23
|
+
|
|
24
|
+
if data_type not in updated_dataset:
|
|
25
|
+
logging.log(logging.WARNING, f"Data type '{data_type}' not found in dataset.")
|
|
26
|
+
return updated_dataset
|
|
27
|
+
|
|
28
|
+
def matches_pattern(classification, pattern):
|
|
29
|
+
"""Check if a classification matches the specified pattern."""
|
|
30
|
+
for key, pattern_value in pattern.items():
|
|
31
|
+
if key not in classification:
|
|
32
|
+
return False
|
|
33
|
+
|
|
34
|
+
if isinstance(pattern_value, dict) and isinstance(classification[key], dict):
|
|
35
|
+
if not matches_pattern(classification[key], pattern_value):
|
|
36
|
+
return False
|
|
37
|
+
elif classification[key] != pattern_value:
|
|
38
|
+
return False
|
|
39
|
+
|
|
40
|
+
return True
|
|
41
|
+
|
|
42
|
+
for item in updated_dataset[data_type]:
|
|
43
|
+
if 'classification' in item and matches_pattern(item['classification'], class_pattern):
|
|
44
|
+
item['classification'] = new_class.copy()
|
|
45
|
+
|
|
46
|
+
return updated_dataset
|
|
@@ -36,3 +36,33 @@ def get_pathlib(storage_config: str | dict, path_root: str) -> Path:
|
|
|
36
36
|
"""
|
|
37
37
|
storage_class = get_storage(storage_config)
|
|
38
38
|
return storage_class.get_pathlib(path_root)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_path_file_count(storage_config: str | dict, path_root: str) -> int:
|
|
42
|
+
"""Get the file count in the path.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
storage_config (str | dict): The storage config by synapse-backend storage api.
|
|
46
|
+
path (str): The path.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
int: The file count in the path.
|
|
50
|
+
"""
|
|
51
|
+
storage_class = get_storage(storage_config)
|
|
52
|
+
pathlib_obj = storage_class.get_pathlib(path_root)
|
|
53
|
+
return storage_class.get_path_file_count(pathlib_obj)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_path_total_size(storage_config: str | dict, path_root: str) -> int:
|
|
57
|
+
"""Get total size of the files in the path.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
storage_config (str | dict): The storage config by synapse-backend storage api.
|
|
61
|
+
path (str): The path.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
int: The total size of the files in the path.
|
|
65
|
+
"""
|
|
66
|
+
storage_class = get_storage(storage_config)
|
|
67
|
+
pathlib_obj = storage_class.get_pathlib(path_root)
|
|
68
|
+
return storage_class.get_path_total_size(pathlib_obj)
|
|
@@ -39,4 +39,34 @@ class BaseStorage:
|
|
|
39
39
|
raise NotImplementedError
|
|
40
40
|
|
|
41
41
|
def get_pathlib(self, path):
|
|
42
|
+
"""Get the path as a pathlib object.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
path (str): The path to convert.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
pathlib.Path: The converted path.
|
|
49
|
+
"""
|
|
50
|
+
raise NotImplementedError
|
|
51
|
+
|
|
52
|
+
def get_path_file_count(self, pathlib_obj):
|
|
53
|
+
"""Get the file count in the path.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
pathlib_obj (UPath): The path to get file count.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
int: The file count in the path.
|
|
60
|
+
"""
|
|
61
|
+
raise NotImplementedError
|
|
62
|
+
|
|
63
|
+
def get_path_total_size(self, pathlib_obj):
|
|
64
|
+
"""Get the total size of the path.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
pathlib_obj (UPath): The path to get total size.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
int: The total size of the path.
|
|
71
|
+
"""
|
|
42
72
|
raise NotImplementedError
|
|
@@ -41,3 +41,38 @@ class S3Storage(BaseStorage):
|
|
|
41
41
|
|
|
42
42
|
def get_pathlib(self, path):
|
|
43
43
|
return self.upath.joinuri(path)
|
|
44
|
+
|
|
45
|
+
def get_path_file_count(self, pathlib_obj: UPath):
|
|
46
|
+
"""Get file count in the path from S3 provider.
|
|
47
|
+
|
|
48
|
+
TODO: Need to find a method to get file count using S3 API
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
pathlib_obj (UPath): The path to get file count.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
int: The file count in the path.
|
|
55
|
+
"""
|
|
56
|
+
count = 0
|
|
57
|
+
files = list(pathlib_obj.glob('**/*'))
|
|
58
|
+
for file in files:
|
|
59
|
+
if file.is_file():
|
|
60
|
+
count += 1
|
|
61
|
+
return count
|
|
62
|
+
|
|
63
|
+
def get_path_total_size(self, pathlib_obj: UPath):
|
|
64
|
+
"""Get total size of the files in the path from S3 provider.
|
|
65
|
+
|
|
66
|
+
TODO: Need to find a method to get total file size using S3 API
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
pathlib_obj (UPath): The path to get total size.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
int: The total size of the files in the path.
|
|
73
|
+
"""
|
|
74
|
+
total_size = 0
|
|
75
|
+
for file in pathlib_obj.glob('**/*'):
|
|
76
|
+
if file.is_file():
|
|
77
|
+
total_size += file.stat().st_size
|
|
78
|
+
return total_size
|
|
@@ -14,3 +14,34 @@ class SFTPStorage(BaseStorage):
|
|
|
14
14
|
if path == '/':
|
|
15
15
|
path = ''
|
|
16
16
|
return UPath(f'sftp://{host}', username=username, password=password) / root_path / path
|
|
17
|
+
|
|
18
|
+
def get_path_file_count(self, pathlib_obj: UPath):
|
|
19
|
+
"""Get file count in the path from SFTP provider.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
pathlib_obj (UPath): The path to get file count.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
int: The file count in the path.
|
|
26
|
+
"""
|
|
27
|
+
count = 0
|
|
28
|
+
files = list(pathlib_obj.glob('**/*'))
|
|
29
|
+
for file in files:
|
|
30
|
+
if file.is_file():
|
|
31
|
+
count += 1
|
|
32
|
+
return count
|
|
33
|
+
|
|
34
|
+
def get_path_total_size(self, pathlib_obj: UPath):
|
|
35
|
+
"""Get total size of the files in the path from SFTP provider.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
pathlib_obj (UPath): The path to get total size.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
int: The total size of the files in the path.
|
|
42
|
+
"""
|
|
43
|
+
total_size = 0
|
|
44
|
+
for file in pathlib_obj.glob('**/*'):
|
|
45
|
+
if file.is_file():
|
|
46
|
+
total_size += file.stat().st_size
|
|
47
|
+
return total_size
|
|
@@ -25,7 +25,7 @@ synapse_sdk/clients/base.py,sha256=RaQN_41NxFKtVsVKB7I7hdKJAR8ScuyCoK_x1D-U0c0,6
|
|
|
25
25
|
synapse_sdk/clients/exceptions.py,sha256=ylv7x10eOp4aA3a48jwonnvqvkiYwzJYXjkVkRTAjwk,220
|
|
26
26
|
synapse_sdk/clients/utils.py,sha256=8pPJTdzHiRPSbZMoQYHAgR2BAMO6u_R_jMV6a2p34iQ,392
|
|
27
27
|
synapse_sdk/clients/agent/__init__.py,sha256=Pz8_iTbIbnb7ywGJ3feqoZVmO2I3mEbwpWsISIxh0BU,1968
|
|
28
|
-
synapse_sdk/clients/agent/core.py,sha256=
|
|
28
|
+
synapse_sdk/clients/agent/core.py,sha256=x2jgORTjT7pJY67SLuc-5lMG6CD5OWpy8UgGeTf7IhA,270
|
|
29
29
|
synapse_sdk/clients/agent/ray.py,sha256=JrwLyVOUDG2yYsbPrxyUtWbM-FWp9B6Bl_GdDby0rt8,1559
|
|
30
30
|
synapse_sdk/clients/agent/service.py,sha256=s7KuPK_DB1nr2VHrigttV1WyFonaGHNrPvU8loRxHcE,478
|
|
31
31
|
synapse_sdk/clients/backend/__init__.py,sha256=Fiehino2n3voaHTdpJHXSY7K_CDnMkQeokapbgeoTBk,1187
|
|
@@ -72,7 +72,7 @@ synapse_sdk/plugins/categories/neural_net/actions/test.py,sha256=JY25eg-Fo6WbgtM
|
|
|
72
72
|
synapse_sdk/plugins/categories/neural_net/actions/train.py,sha256=kve6iTCg2kUeavMQTR2JFuoYDu-QWZFFlB58ZICQtdM,5406
|
|
73
73
|
synapse_sdk/plugins/categories/neural_net/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
74
|
synapse_sdk/plugins/categories/neural_net/base/inference.py,sha256=R5DASI6-5vzsjDOYxqeGGMBjnav5qHF4hNJT8zNUR3I,1097
|
|
75
|
-
synapse_sdk/plugins/categories/neural_net/templates/config.yaml,sha256=
|
|
75
|
+
synapse_sdk/plugins/categories/neural_net/templates/config.yaml,sha256=uZVuXjIfsd_pTaSKptHeHn1TN2FIiLrvvpkClToc6po,596
|
|
76
76
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
77
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py,sha256=InfqKWJYi6sqiUnfPKHC5KYGhxckDaWZNQ202u-uVP4,366
|
|
78
78
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/test.py,sha256=kYyk7l4UtcDUAH4nkdVUGrHHHjxI4p1U13HSLnmGPyE,53
|
|
@@ -114,6 +114,7 @@ synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/plugin
|
|
|
114
114
|
synapse_sdk/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
115
115
|
synapse_sdk/shared/enums.py,sha256=WMZPag9deVF7VCXaQkLk7ly_uX1KwbNzRx9TdvgaeFE,138
|
|
116
116
|
synapse_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
|
+
synapse_sdk/utils/dataset.py,sha256=zWTzFmv589izFr62BDuApi3r5FpTsdm-5AmriC0AEdM,1865
|
|
117
118
|
synapse_sdk/utils/debug.py,sha256=F7JlUwYjTFZAMRbBqKm6hxOIz-_IXYA8lBInOS4jbS4,100
|
|
118
119
|
synapse_sdk/utils/file.py,sha256=zP8eOZifGiYP9PyC4ivQwxs-ljbtXRtbWN4yOjZF6tc,6658
|
|
119
120
|
synapse_sdk/utils/module_loading.py,sha256=chHpU-BZjtYaTBD_q0T7LcKWtqKvYBS4L0lPlKkoMQ8,1020
|
|
@@ -123,15 +124,15 @@ synapse_sdk/utils/pydantic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
123
124
|
synapse_sdk/utils/pydantic/config.py,sha256=1vYOcUI35GslfD1rrqhFkNXXJOXt4IDqOPSx9VWGfNE,123
|
|
124
125
|
synapse_sdk/utils/pydantic/errors.py,sha256=0v0T12eQBr1KrFiEOBu6KMaPK4aPEGEC6etPJGoR5b4,1061
|
|
125
126
|
synapse_sdk/utils/pydantic/validators.py,sha256=G47P8ObPhsePmd_QZDK8EdPnik2CbaYzr_N4Z6En8dc,193
|
|
126
|
-
synapse_sdk/utils/storage/__init__.py,sha256=
|
|
127
|
+
synapse_sdk/utils/storage/__init__.py,sha256=HmZHqvoV-EogV2bE-Sw5XQRlrNuf3gfNL9irAJeRYsA,2195
|
|
127
128
|
synapse_sdk/utils/storage/registry.py,sha256=WaSN9SJR7s9sZgmTVl5k4mLFz-9R6X4ii82wefxs95A,335
|
|
128
|
-
synapse_sdk/utils/storage/providers/__init__.py,sha256=
|
|
129
|
+
synapse_sdk/utils/storage/providers/__init__.py,sha256=x7RGwZryT2FpVxS7fGWryRVpquHzAiIfTz-9uLgjleo,1860
|
|
129
130
|
synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_ncGITZrL0u5wEA,363
|
|
130
|
-
synapse_sdk/utils/storage/providers/s3.py,sha256=
|
|
131
|
-
synapse_sdk/utils/storage/providers/sftp.py,sha256=
|
|
132
|
-
synapse_sdk-1.0.
|
|
133
|
-
synapse_sdk-1.0.
|
|
134
|
-
synapse_sdk-1.0.
|
|
135
|
-
synapse_sdk-1.0.
|
|
136
|
-
synapse_sdk-1.0.
|
|
137
|
-
synapse_sdk-1.0.
|
|
131
|
+
synapse_sdk/utils/storage/providers/s3.py,sha256=W94rQvhGRXti3R4mYP7gmU5pcyCQpGFIBLvxxqLVdRM,2231
|
|
132
|
+
synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
|
|
133
|
+
synapse_sdk-1.0.0a36.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
|
|
134
|
+
synapse_sdk-1.0.0a36.dist-info/METADATA,sha256=q_dbloQbRO4v_kWdEH5BFmftNs0ocAHu5agv_cOvJA8,1160
|
|
135
|
+
synapse_sdk-1.0.0a36.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
136
|
+
synapse_sdk-1.0.0a36.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
|
|
137
|
+
synapse_sdk-1.0.0a36.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
|
|
138
|
+
synapse_sdk-1.0.0a36.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|