Step 1: Extracting Data Using Visual Layer’s API
First, let’s set up a Python class to handle the API calls for exporting datasets.Simplified Python API
We’ll use the following class to encapsulate the API calls:Usage Example
You’ll need to replace theurl
, dataset_id
, and file_name
with your own values:
Expected Output
Step 2: Parsing Exported Metadata
After extracting your data, you’ll have ametadata.json
file. Let’s learn how to parse and analyze it.
Loading the Exported Metadata
First, let’s load the exported metadata into a pandas dataframe:View the Dataset Level Information
schema_version | dataset | description | dataset_url | export_time | dataset_creation_time | exported_by | total_media_items |
---|---|---|---|---|---|---|---|
1.1 | food101 | Exported from food101 at Visual Layer | Link | 2025-02-10T14:29:53.740569 | 2024-12-05T05:55:27.725598 | Dickson Neoh | 118 |
Get Image Level Details
Each row in the dataframe corresponds to an image:media_id | media_type | file_name | file_path | file_size | uniqueness_score | height | width | url | cluster_id | metadata_items |
---|---|---|---|---|---|---|---|---|---|---|
d5227901-22c9-4744-a264-407d9671aa4a | image | 548938.jpg | 548938.jpg | 32.00KB | 0.004178 | 512 | 512 | Link | fbcad8ef-d863-46c9-83b7-1a3bd85e2e2b | [type’: ‘issue’, ‘properties’: issue_type’… |
2546c70a-e0a4-4bfb-ac59-e2895bb96456 | image | 548231.jpg | 548231.jpg | 32.00KB | 0.006069 | 512 | 512 | Link | fbcad8ef-d863-46c9-83b7-1a3bd85e2e2b | [type’: ‘issue’, ‘properties’: issue_type’… |
45c226e0-daba-4ca8-8eac-fec9d490ea36 | image | 835953.jpg | 835953.jpg | 28.18KB | 0.003515 | 512 | 384 | Link | 5bc63415-76d8-49ec-975a-9a021bf98770 | [type’: ‘issue’, ‘properties’: issue_type’… |
Step 3: Analyzing Your Data
Filter By Uniqueness Score
By filtering by uniqueness score, you can get a representative sample of the images in the dataset:Get Duplicate Images
Themetadata_items
column contains a list of issues for each image. We can filter for images with duplicate issues above a certain confidence threshold:
Get Mislabels
We can filter for images with mislabel issues above a certain confidence threshold:Step 4: Converting Video Frame Data to CSV
If your exported JSON contains video frame data, here’s how to parse it into CSV format:Example Video Frame JSON Structure
Converting Video Frame Data to CSV
Step 5: Converting Object Detection Data to CSV
For datasets with bounding box annotations and user tags, here’s how to convert them to CSV format:Example Object Detection JSON Structure
Converting Object Detection Data to CSV
Expected CSV Output
Filename | X | Y | W | H | Label | User Tag |
---|---|---|---|---|---|---|
000000046252.jpg | 148 | 177 | 127 | 188 | Person | test-tags |
000000046252.jpg | 192 | 194 | 75 | 65 | Shirt | test-tags |
000000012639.jpg | 28 | 368 | 80 | 118 | Vest | test-tags |
Step 6: Analyzing Video Frame Similarity
For datasets with video frames, you can analyze similarity between frames to understand which videos are most similar. This is useful for identifying duplicate content, finding related videos, or grouping similar content.Creating a Video Frame Data Table
First, let’s extract video frame information along with their similarity data:Creating a Video Similarity Aggregation Table
Now let’s create a table that shows video-to-video similarity. This analysis only compares frames between different videos, excluding similarities within the same video:Alternative Approach Using Clustering
You can also use thecluster_id
field to find similar frames:
Export Results to CSV
Finally, export your analysis results:Expected Output
The analysis will produce tables like: Video Similarity Table:video_a | video_b | average_similarity | number_of_similar_frames |
---|---|---|---|
video1.mp4 | video2.mp4 | 0.9850 | 15 |
video3.mp4 | video4.mp4 | 0.9720 | 8 |
video_a | video_b | shared_clusters | frames_from_video_a | frames_from_video_b |
---|---|---|---|---|
video1.mp4 | video2.mp4 | 5 | 12 | 18 |
- Which videos have the most similar content
- How many frames are similar between video pairs
- The confidence level of similarities
- Clusters of related video content
Step 7: Analyzing Mislabel Issues
For datasets with mislabel detection, you can analyze which labels are potentially incorrect and what the suggested corrections are. This is valuable for improving dataset quality and understanding systematic labeling issues.Understanding Mislabel Structure
Mislabel issues are stored within object labels and have this structure:issues_description
: The suggested correct labelconfidence
: How confident the system is about the mislabel (0-1)
Comprehensive Mislabel Analysis
Here’s how to extract and analyze all mislabel information:Mislabel Statistics and Analysis
High-Confidence Corrections Analysis
Summary Statistics and Export
Expected Output
The analysis will produce results like:- Identify systematic labeling issues: Classes that are frequently mislabeled
- Prioritize corrections: Focus on high-confidence suggestions first
- Understand label confusion: See which classes are commonly confused with each other
- Improve dataset quality: Apply suggested corrections to improve training data
- Analyze labeling patterns: Understand if certain types of objects are consistently mislabeled
Next Steps
Now that you know how to work with exported metadata files, you can:- Analyze data quality by filtering for different issue types and confidence thresholds
- Create data subsets using uniqueness scores and clustering information
- Export to different formats for use in other tools and platforms
- Build automated workflows to process exported datasets at scale
- Analyze video similarity to find duplicate content, group related videos, or identify the most unique content
- Analyze mislabel issues to identify systematic labeling problems and prioritize corrections