Create a Project Version

Create a new version for your project using the API

To create a project version, use the project.generate_version() method.

import roboflow

rf = roboflow.Roboflow(api_key=YOUR_API_KEY_HERE)

project = rf.workspace().project("PROJECT_ID")

project.generate_version(settings={})

Here is a full example of the settings. There is a detailed explanation for each property below.

{
    "augmentation": {
        "bbblur": { "pixels": 1.5 },
        "bbbrightness": { "brighten": true, "darken": false, "percent": 91 },
        "bbcrop": { "min": 12, "max": 71 },
        "bbexposure": { "percent": 30 },
        "bbflip": { "horizontal": true, "vertical": false },
        "bbnoise": { "percent": 50 },
        "bbninety": { "clockwise": true, "counter-clockwise": false, "upside-down": false },
        "bbrotate": { "degrees": 45 },
        "bbshear": { "horizontal": 45, "vertical": 45 },
        "blur": { "pixels": 1.5 },
        "brightness": { "brighten": true, "darken": false, "percent": 91 },
        "crop": { "min": 12, "max": 71 },
        "cutout": { "count": 26, "percent": 71 },
        "exposure": { "percent": 30 },
        "flip": { "horizontal": true, "vertical": false },
        "hue": { "degrees": 180 },
        "image": { "versions": 32 },
        "mosaic": true,
        "ninety": { "clockwise": true, "counter-clockwise": false, "upside-down": false },
        "noise": { "percent": 50 },
        "rgrayscale": { "percent": 50 },
        "rotate": { "degrees": 45 },
        "saturation": { "percent": 50 },
        "shear": { "horizontal": 45, "vertical": 45 }
    },
    "preprocessing": {
        "auto-orient": true,
        "contrast": { "type": "Contrast Stretching" },
        "filter-null": { "percent": 50 },
        "filter-tags": { "tag_name": true, "other_tag": false },
        "grayscale": true,
        "isolate": true,
        "remap": { "original_class_name": "new_class_name" },
        "resize": { "width": 200, "height": 200, "format": "Stretch to" },
        "static-crop": { "x_min": 10, "x_max": 90, "y_min": 10, "y_max": 90 },
        "tile": { "rows": 2, "columns": 2 }
    }
}

Project Version Creation Options

Augmentation:

  • image: A setting equivalent to the "Maximum Version Size" option in the UI. For creating multiple augmented versions of an image. Accepts versions to specify the number of augmented versions per each original image.

  • bbblur: A bounding box level augmentation for blurring the contents of a bounding box. Accepts pixels, specifying the level of random Gaussian blur to apply.

  • bbbrightness: A bounding box level augmentation for adjusting brightness. Accepts brighten (boolean), darken (boolean), and percent (integer) to control brightness adjustment.

  • bbcrop: A bounding box level augmentation for cropping within bounding boxes. Accepts min and max to specify the range of cropping.

  • bbexposure: A bounding box level augmentation for adjusting exposure. Accepts percent to control the exposure adjustment.

  • bbflip: A bounding box level augmentation for flipping bounding boxes. Accepts horizontal (boolean) and vertical (boolean) to control flipping.

  • bbnoise: A bounding box level augmentation for adding noise within bounding boxes. Accepts percent to specify the level of noise.

  • bbninety: A bounding box level augmentation for rotating by 90-degree increments. Accepts clockwise (boolean), counter-clockwise (boolean), and upside-down (boolean) to control rotation.

  • bbrotate: A bounding box level augmentation for rotating bounding boxes. Accepts degrees to specify the rotation angle.

  • bbshear: A bounding box level augmentation for shearing bounding boxes. Accepts horizontal and vertical to control shearing.

  • blur: An augmentation for blurring the entire image. Accepts pixels to specify the level of Gaussian blur.

  • brightness: An augmentation for adjusting brightness. Accepts brighten (boolean), darken (boolean), and percent (integer) to control brightness adjustment.

  • crop: An augmentation for cropping the entire image. Accepts min and max to specify the range of cropping.

  • cutout: An augmentation for cutout. Accepts count and percent to control the number and size of cutout regions.

  • exposure: An augmentation for adjusting exposure. Accepts percent to control the exposure adjustment.

  • flip: An augmentation for flipping the entire image. Accepts horizontal (boolean) and vertical (boolean) to control flipping.

  • hue: An augmentation for adjusting hue. Accepts degrees to specify the hue adjustment.

  • mosaic: An augmentation for creating mosaics. Accepts a boolean value.

  • ninety: An augmentation for rotating by 90-degree increments. Accepts clockwise (boolean), counter-clockwise (boolean), and upside-down (boolean) to control rotation.

  • noise: An augmentation for adding noise to the entire image. Accepts percent to specify the level of noise.

  • rgrayscale: An augmentation for converting to grayscale. Accepts percent to control the percentage of conversion to grayscale.

  • rotate: An augmentation for rotating the entire image. Accepts degrees to specify the rotation angle.

  • saturation: An augmentation for adjusting saturation. Accepts percent to specify the saturation adjustment.

  • shear: An augmentation for shearing the entire image. Accepts horizontal and vertical controls shearing.

Preprocessing:

  • auto-orient: Automatically discards EXIF rotations and standardizes pixel ordering. Accepts a boolean true or false.

  • contrast: Adjusts contrast using a specific method. Accepts type to specify the contrast adjustment method.

  • filter-null: Filters out null annotations. Accepts percent to control the percentage of null annotations to filter.

  • filter-tags: Filters out images based on tag. If true, only images with that tag will be included in the version. If false, only images without that tag will be included in the version. In order to omit tag-less images, you can set "::none::": false , and true to require images to be tag-less.

  • grayscale: Converts the image to grayscale. Accepts a boolean true or false.

  • isolate: Isolates each object in a separate image. Accepts a boolean true or false.

  • remap: Renames classes in annotations. Accepts original_class_name and new_class_name to specify the class renaming.

  • resize: Resizes the image. Accepts width, height, and format to specify the new dimensions and format.

  • static-crop: Performs a static crop on the image. Accepts x_min, x_max, y_min, and y_max to specify the crop region.

  • tile: Tiles the image into a grid. Accepts rows and columns to specify the number of rows and columns in the grid.

Last updated