synapse-sdk 1.0.0b12__py3-none-any.whl → 1.0.0b14__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.
- locale/ko/LC_MESSAGES/messages.mo +0 -0
- synapse_sdk/clients/agent/ray.py +9 -11
- synapse_sdk/clients/backend/annotation.py +1 -1
- synapse_sdk/clients/backend/core.py +31 -4
- synapse_sdk/clients/backend/data_collection.py +78 -5
- synapse_sdk/clients/backend/hitl.py +1 -1
- synapse_sdk/clients/backend/ml.py +1 -1
- synapse_sdk/clients/base.py +23 -16
- synapse_sdk/devtools/docs/docs/api/clients/agent.md +43 -0
- synapse_sdk/devtools/docs/docs/api/clients/backend.md +53 -0
- synapse_sdk/devtools/docs/docs/api/clients/base.md +35 -0
- synapse_sdk/devtools/docs/docs/api/clients/ray.md +321 -0
- synapse_sdk/devtools/docs/docs/api/index.md +52 -0
- synapse_sdk/devtools/docs/docs/api/plugins/categories.md +43 -0
- synapse_sdk/devtools/docs/docs/api/plugins/models.md +59 -0
- synapse_sdk/devtools/docs/docs/api/plugins/utils.md +328 -0
- synapse_sdk/devtools/docs/docs/api/utils/file.md +195 -0
- synapse_sdk/devtools/docs/docs/api/utils/network.md +378 -0
- synapse_sdk/devtools/docs/docs/api/utils/storage.md +57 -0
- synapse_sdk/devtools/docs/docs/api/utils/types.md +51 -0
- synapse_sdk/devtools/docs/docs/categories.md +0 -0
- synapse_sdk/devtools/docs/docs/cli-usage.md +280 -0
- synapse_sdk/devtools/docs/docs/concepts/index.md +38 -0
- synapse_sdk/devtools/docs/docs/configuration.md +83 -0
- synapse_sdk/devtools/docs/docs/contributing.md +306 -0
- synapse_sdk/devtools/docs/docs/examples/index.md +29 -0
- synapse_sdk/devtools/docs/docs/faq.md +179 -0
- synapse_sdk/devtools/docs/docs/features/converters/index.md +455 -0
- synapse_sdk/devtools/docs/docs/features/index.md +24 -0
- synapse_sdk/devtools/docs/docs/features/plugins/index.md +509 -0
- synapse_sdk/devtools/docs/docs/installation.md +94 -0
- synapse_sdk/devtools/docs/docs/introduction.md +47 -0
- synapse_sdk/devtools/docs/docs/quickstart.md +78 -0
- synapse_sdk/devtools/docs/docs/troubleshooting.md +519 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/_category_.json +8 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/congratulations.md +23 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-blog-post.md +34 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-document.md +57 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-page.md +43 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/deploy-your-site.md +31 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/markdown-features.mdx +152 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/_category_.json +7 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/img/localeDropdown.png +0 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/manage-docs-versions.md +55 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/translate-your-site.md +88 -0
- synapse_sdk/devtools/docs/docusaurus.config.ts +5 -3
- synapse_sdk/devtools/docs/i18n/ko/code.json +325 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/agent.md +43 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/backend.md +53 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/base.md +35 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ray.md +321 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/index.md +52 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/utils/file.md +195 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/utils/network.md +378 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/utils/storage.md +60 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/utils/types.md +51 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/categories.md +0 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/cli-usage.md +280 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/concepts/index.md +38 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/configuration.md +83 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/contributing.md +306 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/examples/index.md +29 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/faq.md +179 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/converters/index.md +30 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/index.md +24 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/plugins/index.md +30 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/installation.md +94 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/introduction.md +47 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/quickstart.md +78 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/troubleshooting.md +519 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current.json +22 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/footer.json +42 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/navbar.json +18 -0
- synapse_sdk/devtools/docs/node_modules/shell-quote/print.py +3 -0
- synapse_sdk/devtools/docs/package.json +1 -1
- synapse_sdk/plugins/categories/export/actions/export.py +50 -2
- synapse_sdk/plugins/categories/export/templates/plugin/export.py +15 -2
- synapse_sdk/plugins/categories/upload/actions/upload.py +42 -27
- synapse_sdk/utils/file.py +77 -0
- {synapse_sdk-1.0.0b12.dist-info → synapse_sdk-1.0.0b14.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0b12.dist-info → synapse_sdk-1.0.0b14.dist-info}/RECORD +86 -20
- {synapse_sdk-1.0.0b12.dist-info → synapse_sdk-1.0.0b14.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0b12.dist-info → synapse_sdk-1.0.0b14.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0b12.dist-info → synapse_sdk-1.0.0b14.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0b12.dist-info → synapse_sdk-1.0.0b14.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: index
|
|
3
|
+
title: Examples
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Examples
|
|
8
|
+
|
|
9
|
+
Practical examples and tutorials for using Synapse SDK.
|
|
10
|
+
|
|
11
|
+
## Getting Started Examples
|
|
12
|
+
|
|
13
|
+
Basic examples to help you get started quickly.
|
|
14
|
+
|
|
15
|
+
## Plugin Examples
|
|
16
|
+
|
|
17
|
+
Real-world plugin examples for different use cases.
|
|
18
|
+
|
|
19
|
+
## Integration Examples
|
|
20
|
+
|
|
21
|
+
Examples of integrating Synapse SDK with other tools and services.
|
|
22
|
+
|
|
23
|
+
## Advanced Examples
|
|
24
|
+
|
|
25
|
+
Complex workflows and advanced usage patterns.
|
|
26
|
+
|
|
27
|
+
## Code Samples
|
|
28
|
+
|
|
29
|
+
Ready-to-use code snippets for common operations.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: faq
|
|
3
|
+
title: Frequently Asked Questions
|
|
4
|
+
sidebar_position: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Frequently Asked Questions
|
|
8
|
+
|
|
9
|
+
Common questions and answers about Synapse SDK.
|
|
10
|
+
|
|
11
|
+
## Installation & Setup
|
|
12
|
+
|
|
13
|
+
### Q: What Python versions are supported?
|
|
14
|
+
|
|
15
|
+
Synapse SDK requires **Python 3.10 or higher**.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install "synapse-sdk[all,devtools]"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Q: How do I install code-server for local development?
|
|
22
|
+
|
|
23
|
+
You have several options:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Recommended: Install script
|
|
27
|
+
curl -fsSL https://code-server.dev/install.sh | sh
|
|
28
|
+
|
|
29
|
+
# Using npm
|
|
30
|
+
npm install -g code-server
|
|
31
|
+
|
|
32
|
+
# Using yarn
|
|
33
|
+
yarn global add code-server
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For more installation methods, visit: [code-server installation guide](https://coder.com/docs/code-server/latest/install)
|
|
37
|
+
|
|
38
|
+
## CLI Usage
|
|
39
|
+
|
|
40
|
+
### Q: How do I start the Synapse CLI?
|
|
41
|
+
|
|
42
|
+
Simply run:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
synapse
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This opens the interactive menu where you can access all Synapse features.
|
|
49
|
+
|
|
50
|
+
### Q: What's the difference between agent and local code-server?
|
|
51
|
+
|
|
52
|
+
- **Agent Code-Server**: Runs on a remote agent with your project files synced. Includes plugin encryption and secure transfer.
|
|
53
|
+
- **Local Code-Server**: Runs on your local machine. Faster startup, uses your local environment and settings.
|
|
54
|
+
|
|
55
|
+
### Q: How do I configure the code-server port?
|
|
56
|
+
|
|
57
|
+
Code-server port is automatically detected from `~/.config/code-server/config.yaml`. If no config exists, it defaults to port 8070.
|
|
58
|
+
|
|
59
|
+
Example config:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
bind-addr: 127.0.0.1:8070
|
|
63
|
+
auth: password
|
|
64
|
+
password: your-password-here
|
|
65
|
+
cert: false
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Q: Why does the agent workspace path differ from my local path?
|
|
69
|
+
|
|
70
|
+
Agents run in containerized environments where your local project is mounted to `/home/coder/workspace`. This is normal and ensures consistent paths across different development environments.
|
|
71
|
+
|
|
72
|
+
## Code-Server Troubleshooting
|
|
73
|
+
|
|
74
|
+
### Q: Code-server shows "not available" error
|
|
75
|
+
|
|
76
|
+
This usually means:
|
|
77
|
+
|
|
78
|
+
1. The agent doesn't have code-server support enabled
|
|
79
|
+
2. Network connectivity issues
|
|
80
|
+
3. Agent is not properly configured
|
|
81
|
+
|
|
82
|
+
**Solution**: Reinstall the agent with code-server support, or check agent configuration.
|
|
83
|
+
|
|
84
|
+
### Q: Browser doesn't open automatically
|
|
85
|
+
|
|
86
|
+
This happens in headless environments or when display is not available.
|
|
87
|
+
|
|
88
|
+
**Solution**: Manually copy the provided URL (including the `?folder=` parameter) to your browser.
|
|
89
|
+
|
|
90
|
+
### Q: Plugin not detected in workspace
|
|
91
|
+
|
|
92
|
+
**Solution**: Ensure your directory contains a valid `config.yaml` file with plugin metadata:
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
name: my-plugin
|
|
96
|
+
version: 1.0.0
|
|
97
|
+
description: My awesome plugin
|
|
98
|
+
entry_point: main.py
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Q: How does plugin encryption work?
|
|
102
|
+
|
|
103
|
+
When opening code-server with an agent, Synapse:
|
|
104
|
+
|
|
105
|
+
1. Detects if your workspace contains a plugin
|
|
106
|
+
2. Creates a ZIP archive of the plugin files
|
|
107
|
+
3. Encrypts the archive using AES-256 encryption
|
|
108
|
+
4. Securely transfers it to the agent
|
|
109
|
+
5. Decrypts and extracts it in the agent workspace
|
|
110
|
+
|
|
111
|
+
This ensures your plugin code is protected during transfer.
|
|
112
|
+
|
|
113
|
+
## Configuration
|
|
114
|
+
|
|
115
|
+
### Q: Where are configuration files stored?
|
|
116
|
+
|
|
117
|
+
- **Synapse Config**: `~/.synapse/devtools.yaml`
|
|
118
|
+
- **Code-Server Config**: `~/.config/code-server/config.yaml`
|
|
119
|
+
|
|
120
|
+
### Q: How do I reset my configuration?
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Remove configuration files
|
|
124
|
+
rm ~/.synapse/devtools.yaml
|
|
125
|
+
rm ~/.config/code-server/config.yaml
|
|
126
|
+
|
|
127
|
+
# Run configuration wizard
|
|
128
|
+
synapse config
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Q: What if I get "Invalid token (401)" error?
|
|
132
|
+
|
|
133
|
+
This means your API token is expired or invalid.
|
|
134
|
+
|
|
135
|
+
**Solution**:
|
|
136
|
+
|
|
137
|
+
1. Generate a new token from your Synapse backend
|
|
138
|
+
2. Run `synapse config` to update the token
|
|
139
|
+
3. Test connection with `synapse --dev-tools`
|
|
140
|
+
|
|
141
|
+
## Plugin Development
|
|
142
|
+
|
|
143
|
+
### Q: How do I create a new plugin?
|
|
144
|
+
|
|
145
|
+
Use the interactive plugin creator:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
synapse
|
|
149
|
+
# Select "🔌 Plugin Management" → "Create new plugin"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This creates a complete plugin structure with examples and documentation.
|
|
153
|
+
|
|
154
|
+
### Q: How do I test plugins locally?
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Test with local script execution
|
|
158
|
+
synapse plugin run my_action '{"param": "value"}' --run-by script
|
|
159
|
+
|
|
160
|
+
# Test with agent execution
|
|
161
|
+
synapse plugin run my_action '{"param": "value"}' --run-by agent
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Always test locally before publishing to ensure your plugin works correctly.
|
|
165
|
+
|
|
166
|
+
### Q: Plugin publishing fails with errors
|
|
167
|
+
|
|
168
|
+
Common issues:
|
|
169
|
+
|
|
170
|
+
1. **Missing dependencies**: Ensure `requirements.txt` includes all needed packages
|
|
171
|
+
2. **Syntax errors**: Test locally first with `--run-by script`
|
|
172
|
+
3. **Configuration errors**: Check `config.yaml` format and required fields
|
|
173
|
+
4. **Backend connectivity**: Ensure backend is accessible and token is valid
|
|
174
|
+
|
|
175
|
+
**Solution**: Use debug mode for detailed error information:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
synapse plugin publish --debug
|
|
179
|
+
```
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: converters
|
|
3
|
+
title: Converters
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Converters
|
|
8
|
+
|
|
9
|
+
The Synapse SDK provides comprehensive data format conversion utilities for computer vision datasets. These converters enable seamless transformation between different annotation formats commonly used in machine learning workflows.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The converter system supports bidirectional conversion between:
|
|
14
|
+
|
|
15
|
+
- **DM Format** - Synapse Data Manager's native annotation format (supports v1 ⟷ v2 migration)
|
|
16
|
+
- **COCO Format** - Microsoft Common Objects in Context format
|
|
17
|
+
- **Pascal VOC Format** - Visual Object Classes XML format
|
|
18
|
+
- **YOLO Format** - You Only Look Once text-based format
|
|
19
|
+
|
|
20
|
+
All converters support both categorized datasets (with train/valid/test splits) and non-categorized datasets. Additionally, all converters now support single file conversion mode for processing individual files.
|
|
21
|
+
|
|
22
|
+
## Supported Annotation Types
|
|
23
|
+
|
|
24
|
+
| Annotation Type | DM | COCO | Pascal VOC | YOLO |
|
|
25
|
+
|----------------|----|----|-----------|------|
|
|
26
|
+
| Bounding Boxes | ✅ | ✅ | ✅ | ✅ |
|
|
27
|
+
| Polygons | ✅ | ✅ | ❌ | ✅ |
|
|
28
|
+
| Segmentation | ✅ | ✅ | ✅ | ❌ |
|
|
29
|
+
| Keypoints | ✅ | ✅ | ❌ | ✅ |
|
|
30
|
+
| Classifications | ✅ | ✅ | ❌ | ❌ |
|
|
31
|
+
|
|
32
|
+
## Pascal VOC Converters
|
|
33
|
+
|
|
34
|
+
### FromDMToPascalConverter
|
|
35
|
+
|
|
36
|
+
Converts DM format annotations to Pascal VOC XML format.
|
|
37
|
+
|
|
38
|
+
**Features:**
|
|
39
|
+
- Converts bounding box annotations and segmentation masks
|
|
40
|
+
- Creates standard Pascal VOC directory structure
|
|
41
|
+
- Generates `classes.txt` file automatically
|
|
42
|
+
- Supports both categorized and non-categorized datasets
|
|
43
|
+
|
|
44
|
+
**Usage:**
|
|
45
|
+
```python
|
|
46
|
+
from synapse_sdk.utils.converters.pascal.from_dm import FromDMToPascalConverter
|
|
47
|
+
|
|
48
|
+
# Convert categorized dataset
|
|
49
|
+
converter = FromDMToPascalConverter(
|
|
50
|
+
root_dir='/path/to/dm/dataset',
|
|
51
|
+
is_categorized_dataset=True
|
|
52
|
+
)
|
|
53
|
+
converted_data = converter.convert()
|
|
54
|
+
converter.save_to_folder('/output/pascal/dataset')
|
|
55
|
+
|
|
56
|
+
# Convert non-categorized dataset
|
|
57
|
+
converter = FromDMToPascalConverter(
|
|
58
|
+
root_dir='/path/to/dm/dataset',
|
|
59
|
+
is_categorized_dataset=False
|
|
60
|
+
)
|
|
61
|
+
converted_data = converter.convert()
|
|
62
|
+
converter.save_to_folder('/output/pascal/dataset')
|
|
63
|
+
|
|
64
|
+
# Single file conversion
|
|
65
|
+
converter = FromDMToPascalConverter(is_single_conversion=True)
|
|
66
|
+
with open('data.json') as f:
|
|
67
|
+
dm_data = json.load(f)
|
|
68
|
+
with open('image.jpg', 'rb') as img_file:
|
|
69
|
+
pascal_xml = converter.convert_single_file(dm_data, img_file)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Input Structure (Categorized):**
|
|
73
|
+
```
|
|
74
|
+
dm_dataset/
|
|
75
|
+
├── train/
|
|
76
|
+
│ ├── json/
|
|
77
|
+
│ │ ├── image1.json
|
|
78
|
+
│ │ └── image2.json
|
|
79
|
+
│ └── original_files/
|
|
80
|
+
│ ├── image1.jpg
|
|
81
|
+
│ └── image2.jpg
|
|
82
|
+
├── valid/
|
|
83
|
+
│ ├── json/
|
|
84
|
+
│ └── original_files/
|
|
85
|
+
└── test/ (optional)
|
|
86
|
+
├── json/
|
|
87
|
+
└── original_files/
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Output Structure:**
|
|
91
|
+
```
|
|
92
|
+
pascal_dataset/
|
|
93
|
+
├── train/
|
|
94
|
+
│ ├── Annotations/
|
|
95
|
+
│ │ ├── image1.xml
|
|
96
|
+
│ │ └── image2.xml
|
|
97
|
+
│ └── Images/
|
|
98
|
+
│ ├── image1.jpg
|
|
99
|
+
│ └── image2.jpg
|
|
100
|
+
├── valid/
|
|
101
|
+
├── test/ (if present)
|
|
102
|
+
└── classes.txt
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### PascalToDMConverter
|
|
106
|
+
|
|
107
|
+
Converts Pascal VOC XML annotations to DM format.
|
|
108
|
+
|
|
109
|
+
**Features:**
|
|
110
|
+
- Parses Pascal VOC XML files
|
|
111
|
+
- Flexible directory naming (supports Annotations/annotations, Images/images/JPEGImages)
|
|
112
|
+
- Extracts bounding box annotations and segmentation information
|
|
113
|
+
- Maintains class information
|
|
114
|
+
|
|
115
|
+
**Usage:**
|
|
116
|
+
```python
|
|
117
|
+
from synapse_sdk.utils.converters.pascal.to_dm import PascalToDMConverter
|
|
118
|
+
|
|
119
|
+
# Convert Pascal VOC dataset
|
|
120
|
+
converter = PascalToDMConverter(
|
|
121
|
+
root_dir='/path/to/pascal/dataset',
|
|
122
|
+
is_categorized_dataset=True
|
|
123
|
+
)
|
|
124
|
+
converted_data = converter.convert()
|
|
125
|
+
converter.save_to_folder('/output/dm/dataset')
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## YOLO Converters
|
|
129
|
+
|
|
130
|
+
### FromDMToYOLOConverter
|
|
131
|
+
|
|
132
|
+
Converts DM format annotations to YOLO format with comprehensive annotation support.
|
|
133
|
+
|
|
134
|
+
**Features:**
|
|
135
|
+
- Supports bounding boxes, polygons, and keypoints
|
|
136
|
+
- Creates `dataset.yaml` configuration file
|
|
137
|
+
- Normalizes coordinates automatically
|
|
138
|
+
- Handles keypoint visibility flags
|
|
139
|
+
|
|
140
|
+
**Usage:**
|
|
141
|
+
```python
|
|
142
|
+
from synapse_sdk.utils.converters.yolo.from_dm import FromDMToYOLOConverter
|
|
143
|
+
|
|
144
|
+
# Convert with all annotation types
|
|
145
|
+
converter = FromDMToYOLOConverter(
|
|
146
|
+
root_dir='/path/to/dm/dataset',
|
|
147
|
+
is_categorized_dataset=True
|
|
148
|
+
)
|
|
149
|
+
converted_data = converter.convert()
|
|
150
|
+
converter.save_to_folder('/output/yolo/dataset')
|
|
151
|
+
|
|
152
|
+
# Single file conversion
|
|
153
|
+
converter = FromDMToYOLOConverter(is_single_conversion=True)
|
|
154
|
+
with open('data.json') as f:
|
|
155
|
+
dm_data = json.load(f)
|
|
156
|
+
with open('image.jpg', 'rb') as img_file:
|
|
157
|
+
yolo_labels = converter.convert_single_file(dm_data, img_file)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Output Structure:**
|
|
161
|
+
```
|
|
162
|
+
yolo_dataset/
|
|
163
|
+
├── train/
|
|
164
|
+
│ ├── images/
|
|
165
|
+
│ │ ├── image1.jpg
|
|
166
|
+
│ │ └── image2.jpg
|
|
167
|
+
│ └── labels/
|
|
168
|
+
│ ├── image1.txt
|
|
169
|
+
│ └── image2.txt
|
|
170
|
+
├── valid/
|
|
171
|
+
├── test/ (if present)
|
|
172
|
+
├── dataset.yaml
|
|
173
|
+
└── classes.txt
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**YOLO Label Format Examples:**
|
|
177
|
+
```
|
|
178
|
+
# Bounding box: class_id center_x center_y width height
|
|
179
|
+
0 0.5 0.5 0.3 0.4
|
|
180
|
+
|
|
181
|
+
# Polygon: class_id x1 y1 x2 y2 x3 y3 x4 y4 ...
|
|
182
|
+
0 0.1 0.1 0.9 0.1 0.9 0.9 0.1 0.9
|
|
183
|
+
|
|
184
|
+
# Keypoints: class_id center_x center_y width height kp1_x kp1_y kp1_v kp2_x kp2_y kp2_v ...
|
|
185
|
+
0 0.5 0.5 0.3 0.4 0.45 0.3 2 0.55 0.3 2 0.5 0.7 1
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### YOLOToDMConverter
|
|
189
|
+
|
|
190
|
+
Converts YOLO format annotations back to DM format.
|
|
191
|
+
|
|
192
|
+
**Features:**
|
|
193
|
+
- Intelligent parsing of different YOLO annotation types
|
|
194
|
+
- Requires `dataset.yaml` for class name mapping
|
|
195
|
+
- Handles bounding boxes, polygons, and keypoints
|
|
196
|
+
- Automatically detects image dimensions
|
|
197
|
+
|
|
198
|
+
**Usage:**
|
|
199
|
+
```python
|
|
200
|
+
from synapse_sdk.utils.converters.yolo.to_dm import YOLOToDMConverter
|
|
201
|
+
|
|
202
|
+
converter = YOLOToDMConverter(
|
|
203
|
+
root_dir='/path/to/yolo/dataset',
|
|
204
|
+
is_categorized_dataset=True
|
|
205
|
+
)
|
|
206
|
+
converted_data = converter.convert()
|
|
207
|
+
converter.save_to_folder('/output/dm/dataset')
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## COCO Converters
|
|
211
|
+
|
|
212
|
+
### FromDMToCOCOConverter
|
|
213
|
+
|
|
214
|
+
Converts DM format to COCO format with full metadata support.
|
|
215
|
+
|
|
216
|
+
**Features:**
|
|
217
|
+
- Comprehensive COCO metadata (info, licenses, categories)
|
|
218
|
+
- Supports bounding boxes, polygons, segmentation, and keypoints
|
|
219
|
+
- Dynamic category management
|
|
220
|
+
- Extensible for different data types
|
|
221
|
+
|
|
222
|
+
**Usage:**
|
|
223
|
+
```python
|
|
224
|
+
from synapse_sdk.utils.converters.coco.from_dm import FromDMToCOCOConverter
|
|
225
|
+
|
|
226
|
+
# Basic conversion
|
|
227
|
+
converter = FromDMToCOCOConverter(
|
|
228
|
+
root_dir='/path/to/dm/dataset',
|
|
229
|
+
is_categorized_dataset=True
|
|
230
|
+
)
|
|
231
|
+
converted_data = converter.convert()
|
|
232
|
+
converter.save_to_folder('/output/coco/dataset')
|
|
233
|
+
|
|
234
|
+
# With custom metadata
|
|
235
|
+
info_dict = {
|
|
236
|
+
"description": "My Custom Dataset",
|
|
237
|
+
"version": "1.0",
|
|
238
|
+
"contributor": "My Organization"
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
licenses_list = [{
|
|
242
|
+
"id": 1,
|
|
243
|
+
"name": "Custom License",
|
|
244
|
+
"url": "https://example.com/license"
|
|
245
|
+
}]
|
|
246
|
+
|
|
247
|
+
converter = FromDMToCOCOConverter(
|
|
248
|
+
root_dir='/path/to/dm/dataset',
|
|
249
|
+
info_dict=info_dict,
|
|
250
|
+
licenses_list=licenses_list,
|
|
251
|
+
is_categorized_dataset=True
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
# Single file conversion
|
|
255
|
+
converter = FromDMToCOCOConverter(
|
|
256
|
+
data_type='img',
|
|
257
|
+
is_single_conversion=True
|
|
258
|
+
)
|
|
259
|
+
with open('data.json') as f:
|
|
260
|
+
dm_data = json.load(f)
|
|
261
|
+
with open('image.jpg', 'rb') as img_file:
|
|
262
|
+
coco_annotation = converter.convert_single_file(dm_data, img_file)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Output Structure:**
|
|
266
|
+
```
|
|
267
|
+
coco_dataset/
|
|
268
|
+
├── train/
|
|
269
|
+
│ ├── annotations.json
|
|
270
|
+
│ ├── image1.jpg
|
|
271
|
+
│ └── image2.jpg
|
|
272
|
+
├── valid/
|
|
273
|
+
│ ├── annotations.json
|
|
274
|
+
│ └── images...
|
|
275
|
+
└── test/ (if present)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### COCOToDMConverter
|
|
279
|
+
|
|
280
|
+
Converts COCO format annotations to DM format.
|
|
281
|
+
|
|
282
|
+
**Features:**
|
|
283
|
+
- Parses COCO JSON annotations
|
|
284
|
+
- Handles image datasets
|
|
285
|
+
- Maintains keypoint groupings through DM groups
|
|
286
|
+
- Supports bounding boxes and keypoints
|
|
287
|
+
|
|
288
|
+
**Usage:**
|
|
289
|
+
```python
|
|
290
|
+
from synapse_sdk.utils.converters.coco.to_dm import COCOToDMConverter
|
|
291
|
+
|
|
292
|
+
converter = COCOToDMConverter(
|
|
293
|
+
root_dir='/path/to/coco/dataset',
|
|
294
|
+
is_categorized_dataset=True
|
|
295
|
+
)
|
|
296
|
+
converted_data = converter.convert()
|
|
297
|
+
converter.save_to_folder('/output/dm/dataset')
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## DM Version Converter
|
|
301
|
+
|
|
302
|
+
### DMV1ToV2Converter
|
|
303
|
+
|
|
304
|
+
Migrates legacy DM v1 datasets to the current v2 format.
|
|
305
|
+
|
|
306
|
+
**Features:**
|
|
307
|
+
- Comprehensive migration for all annotation types
|
|
308
|
+
- Handles data structure changes between versions
|
|
309
|
+
- Supports images and videos
|
|
310
|
+
- Maintains annotation tool integrity
|
|
311
|
+
|
|
312
|
+
**Supported Tools:**
|
|
313
|
+
- Bounding boxes
|
|
314
|
+
- Named entities
|
|
315
|
+
- Classifications with attributes
|
|
316
|
+
- Polylines and polygons
|
|
317
|
+
- Keypoints
|
|
318
|
+
- 3D bounding boxes
|
|
319
|
+
- Segmentation
|
|
320
|
+
- Relations and groups
|
|
321
|
+
|
|
322
|
+
**Usage:**
|
|
323
|
+
```python
|
|
324
|
+
from synapse_sdk.utils.converters.dm.from_v1 import DMV1ToV2Converter
|
|
325
|
+
|
|
326
|
+
converter = DMV1ToV2Converter(
|
|
327
|
+
root_dir='/path/to/dm/v1/dataset',
|
|
328
|
+
is_categorized_dataset=True
|
|
329
|
+
)
|
|
330
|
+
converted_data = converter.convert()
|
|
331
|
+
converter.save_to_folder('/output/dm/v2/dataset')
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### DMV2ToV1Converter
|
|
335
|
+
|
|
336
|
+
Converts DM v2 datasets back to the legacy v1 format for compatibility with older systems.
|
|
337
|
+
|
|
338
|
+
**Features:**
|
|
339
|
+
- Reverse migration from DM v2 to v1 format
|
|
340
|
+
- Preserves all annotation types and metadata
|
|
341
|
+
- Maintains coordinate integrity across formats
|
|
342
|
+
- Generates appropriate v1 structure with annotations and annotationsData
|
|
343
|
+
|
|
344
|
+
**Supported Tools:**
|
|
345
|
+
- Bounding boxes
|
|
346
|
+
- Named entities
|
|
347
|
+
- Classifications with attributes
|
|
348
|
+
- Polylines and polygons
|
|
349
|
+
- Keypoints
|
|
350
|
+
- 3D bounding boxes
|
|
351
|
+
- Segmentation
|
|
352
|
+
- Relations and groups
|
|
353
|
+
|
|
354
|
+
**Usage:**
|
|
355
|
+
```python
|
|
356
|
+
from synapse_sdk.utils.converters.dm.to_v1 import DMV2ToV1Converter
|
|
357
|
+
|
|
358
|
+
# Load v2 data and convert to v1
|
|
359
|
+
with open('dm_v2_data.json', 'r') as f:
|
|
360
|
+
v2_data = json.load(f)
|
|
361
|
+
|
|
362
|
+
converter = DMV2ToV1Converter(v2_data)
|
|
363
|
+
v1_data = converter.convert()
|
|
364
|
+
|
|
365
|
+
# Save or use the converted v1 data
|
|
366
|
+
with open('dm_v1_data.json', 'w') as f:
|
|
367
|
+
json.dump(v1_data, f, indent=2)
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Common Parameters
|
|
371
|
+
|
|
372
|
+
All converters share these common parameters:
|
|
373
|
+
|
|
374
|
+
### `root_dir` (str)
|
|
375
|
+
Path to the root directory containing the dataset. Not required when using single file conversion mode.
|
|
376
|
+
|
|
377
|
+
### `is_categorized_dataset` (bool)
|
|
378
|
+
- `True`: Dataset has train/valid/test splits in separate subdirectories
|
|
379
|
+
- `False`: Dataset is in a single directory without splits
|
|
380
|
+
|
|
381
|
+
### `is_single_conversion` (bool)
|
|
382
|
+
- `True`: Enable single file conversion mode for processing individual files
|
|
383
|
+
- `False`: Process entire dataset directories (default behavior)
|
|
384
|
+
|
|
385
|
+
### Common Methods
|
|
386
|
+
|
|
387
|
+
#### `convert()`
|
|
388
|
+
Performs in-memory conversion and returns the converted data structure.
|
|
389
|
+
|
|
390
|
+
#### `convert_single_file(data, original_file, **kwargs)`
|
|
391
|
+
Available when `is_single_conversion=True`. Converts a single data object and corresponding original file.
|
|
392
|
+
|
|
393
|
+
#### `save_to_folder(output_dir)`
|
|
394
|
+
Saves the converted data to the specified output directory, creating the appropriate file structure for the target format.
|
|
395
|
+
|
|
396
|
+
## Error Handling
|
|
397
|
+
|
|
398
|
+
All converters include robust error handling:
|
|
399
|
+
|
|
400
|
+
- **File Validation**: Checks for required files and directories
|
|
401
|
+
- **Format Validation**: Validates annotation format correctness
|
|
402
|
+
- **Graceful Degradation**: Warns about unsupported annotations instead of failing
|
|
403
|
+
- **Progress Tracking**: Shows progress for large dataset conversions
|
|
404
|
+
|
|
405
|
+
## Best Practices
|
|
406
|
+
|
|
407
|
+
1. **Backup Original Data**: Always keep backups before conversion
|
|
408
|
+
2. **Validate Results**: Check converted annotations for accuracy
|
|
409
|
+
3. **Test on Small Datasets**: Test conversion on small samples first
|
|
410
|
+
4. **Check Requirements**: Ensure all required files (dataset.yaml, annotations.json, etc.) are present
|
|
411
|
+
5. **Monitor Warnings**: Pay attention to conversion warnings for data quality issues
|
|
412
|
+
|
|
413
|
+
## Examples
|
|
414
|
+
|
|
415
|
+
### Converting a Complete Workflow
|
|
416
|
+
|
|
417
|
+
```python
|
|
418
|
+
# 1. Convert Pascal VOC to DM
|
|
419
|
+
pascal_converter = PascalToDMConverter('/data/pascal', True)
|
|
420
|
+
dm_data = pascal_converter.convert()
|
|
421
|
+
pascal_converter.save_to_folder('/data/dm_intermediate')
|
|
422
|
+
|
|
423
|
+
# 2. Convert DM to YOLO
|
|
424
|
+
yolo_converter = FromDMToYOLOConverter('/data/dm_intermediate', True)
|
|
425
|
+
yolo_data = yolo_converter.convert()
|
|
426
|
+
yolo_converter.save_to_folder('/data/yolo_final')
|
|
427
|
+
|
|
428
|
+
# 3. Convert DM to COCO for evaluation
|
|
429
|
+
coco_converter = FromDMToCOCOConverter('/data/dm_intermediate', True)
|
|
430
|
+
coco_data = coco_converter.convert()
|
|
431
|
+
coco_converter.save_to_folder('/data/coco_eval')
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Single File Conversion Example
|
|
435
|
+
|
|
436
|
+
```python
|
|
437
|
+
import json
|
|
438
|
+
from synapse_sdk.utils.converters.yolo.from_dm import FromDMToYOLOConverter
|
|
439
|
+
|
|
440
|
+
# Initialize converter for single file processing
|
|
441
|
+
converter = FromDMToYOLOConverter(is_single_conversion=True)
|
|
442
|
+
|
|
443
|
+
# Load DM format data
|
|
444
|
+
with open('annotation.json', 'r') as f:
|
|
445
|
+
dm_data = json.load(f)
|
|
446
|
+
|
|
447
|
+
# Convert single file
|
|
448
|
+
with open('image.jpg', 'rb') as img_file:
|
|
449
|
+
yolo_labels = converter.convert_single_file(dm_data, img_file)
|
|
450
|
+
|
|
451
|
+
# yolo_labels contains the converted YOLO format labels
|
|
452
|
+
print(yolo_labels)
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
This converter system provides a complete solution for dataset format transformation, enabling seamless integration between different machine learning workflows and annotation tools.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: features
|
|
3
|
+
title: Features
|
|
4
|
+
sidebar_position: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Features
|
|
8
|
+
|
|
9
|
+
This section covers the key features and functionality provided by the Synapse SDK.
|
|
10
|
+
|
|
11
|
+
## [Plugin System](./plugins/index.md)
|
|
12
|
+
|
|
13
|
+
Comprehensive plugin framework for building and managing ML workflows.
|
|
14
|
+
|
|
15
|
+
- **[Plugin Categories](./plugins/index.md#plugin-categories)** - Neural networks, export, upload, smart tools, and validation plugins
|
|
16
|
+
- **[Execution Methods](./plugins/index.md#execution-methods)** - Job, Task, and REST API execution modes
|
|
17
|
+
- **[Development Guide](./plugins/index.md#creating-plugins)** - Create, test, and deploy custom plugins
|
|
18
|
+
|
|
19
|
+
## [Data Converters](./converters/index.md)
|
|
20
|
+
|
|
21
|
+
Comprehensive data format conversion utilities for computer vision datasets.
|
|
22
|
+
|
|
23
|
+
- **[Format Converters](./converters/index.md)** - Convert between DM, COCO, Pascal VOC, and YOLO formats
|
|
24
|
+
- **[Version Migration](./converters/index.md#dm-version-converter)** - Migrate DM datasets between versions
|