LogoLogo
  • Seahaven
    • Seahaven Documentation
      • Setup Your Account
      • Getting Started
        • Prepare Your Models
          • Name Objects
          • Add Camera Curve to a scene
        • Import 3D Assets
        • Colormap Editor
        • Relationship Editor
          • Start Workflow
            • Workflow
            • Relationship
              • Relationship (Array)
          • Relationships
            • Placements
            • Locate
            • Rotate
            • Neighbour
            • Drop
            • Center
            • Scale
            • Align
            • Attach
            • Put
        • Simulation Editor
          • Workflow
            • Category Visibility Threshold
          • Scene
            • 3D Asset
            • HDRI Lighting
            • Physical Sun/Sky
            • Ground Plane
            • Interior Scene
            • Room Type
          • Relationships
            • Load Relationships
          • Camera
            • Camera Configuration
            • Animated Track Camera
            • Curve-Based Camera
            • Room-Perimeter Camera
              • Category
            • Room-Based Camera
              • Additional Cameras
            • Position Camera
              • Conical
              • Spherical
              • Cubic
            • Orientation
              • Calculate Area of Interest
              • Point
            • Perspectival Camera Properties
            • Fisheye Camera Properties
          • Manipulators
            • Camera Manipulators
              • Override Camera Target
              • Override Camera Position
              • Near IR (Approximation)
              • Track Camera to Object
                • Camera Path Settings
            • Light Manipulators
              • Randomize HDRI Background
              • Modify Light Strength
              • Place Lights
                • Light Object (Bbox)
                • Light Object (Polar)
            • Material Manipulators
              • Randomize Material Color
              • Randomize Material Properties
              • Swap Materials
                • Import Material
                • Replace Material
                • Weighted Material
            • Delete Objects by Name
            • Pose Objects
              • Pose Set
              • Pose Pair
            • Constrain Object
            • Add Particle System
            • Load Object Along Curve
            • Replace
              • View settings
              • Load child object
          • Output
            • Additional Annotation Settings
            • Color Map
            • Camera Ex/Intrinsics
            • Keypoints
            • Normal Map
            • Depth Map
          • Post-Processing
            • Visualize COCO Annotations
            • Shot Noise
            • Glare
            • Disable shadows
        • Running Simulation
        • Save and Import
    • Seahaven Tutorials
    • Errors and Alerts
  • Simulation Manager
    • Simulation Manager
  • Simulation API
    • Simulation Structure
      • Sample Configuration
    • Modules
      • Structure Modules
        • Generator Class
          • generator.Room
            • Submodule: RoomTextureLoader
            • Submodule: RoomLightLoader
            • How To Query Room Properties
            • Sample Room Configuration
        • Loader Class
          • loader.ObjectLoader
      • Placement Modules
        • Placement Class
          • placement.PlacementHandler
            • Placement Rules
              • Settings
      • Lighting Modules
        • Lighting Class
          • lighting.HdriLoader
          • lighting.LightLoader
      • Camera Modules
        • Camera Class
          • camera.CameraSampler
          • camera.RoomCamera
            • Submodule: proximity_checks
            • Submodule: default_cam_param
      • Output Modules
        • Renderer Class
          • renderer.MultiRenderer
            • Submodule: RgbRenderer
            • Submodule: InstanceRenderer
            • Submodule: SemanticRenderer
            • Submodule: DepthRenderer
            • Submodule: BoundingBoxWriter
  • Management API
    • RESTful API
    • Python API
      • Example
    • Python API (V4 - BETA)
      • Installation
      • Merge Datasets
      • Methods
      • Dataset Analysis
      • Compression Artifacts
      • Domain Matching
      • Credentials
  • API Tutorials
    • Residential Interior Simulation
      • Upload Your Placement Rules
      • Modifying Your Camera
      • Modify Placement Rules
      • Run your Simulation
      • Tutorial Materials
        • Pipeline Configuration
        • Placement Rules
          • bedroom1.yaml
          • bedroom2.yaml
          • livingroom.yaml
          • floorPlan.yaml
Powered by GitBook
On this page
  • Arguments:
  • Example Use:
Export as PDF
  1. Management API
  2. Python API (V4 - BETA)

Merge Datasets

Combine multiple synthetic datasets into one

Merges multiple COCO (Common Objects in Context) datasets stored in different directories into a single, new dataset. The function randomly samples a given percentage of images (and their associated annotations) from each directory to be included in the merged dataset. The merged dataset will include the images, annotations, and categories from each of the original datasets.

Arguments:

  • json_dirs (type: list of strings)

    • Description: A list of directory paths where each directory contains a COCO-formatted JSON annotation file named "annotations.json" and associated image files.

    • Example: ["path/to/dataset1", "path/to/dataset2"]

  • percentages (type: list of integers or floats)

    • Description: A list of percentages specifying how much data to keep from each directory in json_dirs. The list length should match the length of json_dirs. Each percentage is between 0 and 100.

    • Example: [50, 60] (This will keep 50% of the data from the first directory and 60% from the second.)

  • output_json_path (type: string)

    • Description: The path where the merged JSON annotation file will be saved. The file will be named "annotations.json".

    • Example: "path/to/merged/annotations.json"

  • output_img_dir (type: string)

    • Description: The directory where the merged image files will be saved. If the directory does not exist, it will be created.

    • Example: "path/to/merged/images"

Example Use:

from lexset.LexsetManager import merge_datasets

# Define the directories containing your COCO JSON files and images
# add as many as you like
json_dirs = ["D:/<path 1>", "D:/<path 2>"]

# Define the percentage of data to keep from each directory
percentages = [50, 50]  # 50% from the first directory, 60% from the second

# Define paths to output JSON and image directory
output_json_path = "D:/<path 3>/coco_annotations.json"
output_img_dir = "D:/<path 3>/"

# Merge the datasets
merge_datasets(json_dirs, percentages, output_json_path, output_img_dir)
PreviousInstallationNextMethods

Last updated 11 months ago