Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda0a7d1

Browse files
Ronen AnukaRonen Anuka
Ronen Anuka
authored and
Ronen Anuka
committed
added images and fixes
1 parent3703a36 commitda0a7d1

File tree

5 files changed

+187
-389
lines changed

5 files changed

+187
-389
lines changed

‎docs/Creating-Datasets/custom-metadata-automation-script.mdx‎

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title:"Custom MetadataAutomation Script"
2+
title:"Custom MetadataUpload Script"
33
description:"Example Python script for automating custom metadata uploads to Visual Layer from folders with individual metadata JSON files."
4-
sidebarTitle:"Automation script"
4+
sidebarTitle:"Custom metadata Upload"
55
---
66

77
<Cardtitle="What This Helps With"icon="code">
@@ -60,6 +60,12 @@ The automation script demonstrates the complete Visual Layer custom metadata API
6060
- Automatically truncates strings to Visual Layer's 255-character limit
6161
- Handles nested objects by serializing to JSON
6262

63+
<Note>
64+
**Adding vs. Updating Metadata:**
65+
-**Adding new fields:** In case custom metadata was already uploaded to a dataset, the script will add new fields.
66+
-**Updating existing fields:** Currently updating existing metadata is not supported. Contact Visual Layer for assistance with updating existing metadata values
67+
</Note>
68+
6369
##Prerequisites
6470

6571
Before using the script, ensure you have:
@@ -83,6 +89,34 @@ your-folder/
8389
└── image3.jpg.metadata.json
8490
```
8591

92+
<Tip>
93+
The`.metadata.json` file naming convention can be customized in the script's`scan_folder()` function to match your specific metadata storage format and naming patterns.
94+
</Tip>
95+
96+
###Alternative: Single JSON File
97+
98+
If your metadata is in a single JSON file instead of individual files per image:
99+
100+
**Example JSON format:**
101+
```json
102+
{
103+
"image1.jpg": {
104+
"confidence":0.95,
105+
"category":"approved"
106+
},
107+
"image2.jpg": {
108+
"confidence":0.87,
109+
"category":"pending"
110+
}
111+
}
112+
```
113+
114+
**To use this format:** Add the`load_single_json_metadata()` method to the`FolderMetadataProcessor` class and call it instead of`scan_folder()` +`load_metadata_files()` in the workflow.
115+
116+
<Cardtitle="View Single JSON Implementation"icon="code"href="/docs/code-blocks/custom-metadata-upload-script">
117+
See the complete code example for handling single JSON files at the bottom of the page.
118+
</Card>
119+
86120
###Metadata File Format
87121

88122
Each`.metadata.json` file should contain field-value pairs:
@@ -105,6 +139,16 @@ Each `.metadata.json` file should contain field-value pairs:
105139
- Arrays:`["tag1", "tag2"]` (for multi-enum fields)
106140
- Objects:`{"key": "value"}` (serialized to JSON string)
107141

142+
###Expected Result in Visual Layer
143+
144+
After running the script, your custom metadata fields will be visible in Visual Layer's interface for each image:
145+
146+
<Frame>
147+
<imgsrc="/images/custom-metadata-example.png"alt="Custom metadata displayed in Visual Layer showing fields like name, float value, list of tags, condition, and date" />
148+
</Frame>
149+
150+
These fields become searchable and filterable, enabling you to query and analyze your dataset based on your custom metadata.
151+
108152
##Installation and Usage
109153

110154
###Install Dependencies
@@ -145,7 +189,7 @@ python upload_metadata_from_folder.py \
145189
|-----------|----------|-------------|---------|
146190
|`--folder`|| Path to folder containing images and .metadata.json files| -|
147191
|`--dataset-id`|| Visual Layer dataset identifier| -|
148-
|`--base-url`|| Visual Layer installation URL|`http://localhost:8080`|
192+
|`--base-url`|| Visual Layer installation URL|`http://localhost:2080`|
149193
|`--field`|| Specify field name and type (repeatable). If omitted, auto-discovers all fields| -|
150194

151195
**Supported Field Types:**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp