Code Monkey home page Code Monkey logo

synthetic-images's Introduction

Creating Synthetic Image Datasets

This tool helps create synthetic data for object detection modeling. Given a folder of background images and object images, this tool iterates through each background and superimposes objects within the frame in random locations, automatically annotating as it goes. The tool also resizes the icons to help the model generalize better to the real world.

Setup

Clone this repo. Then create and activate the conda environment provided:

$ conda env create -f environment.yml
$ conda activate images

Place background images in the Backgrounds/ subfolder and objects in the Objects/ subfolder.

Create

Run the create.py script to generate hundreds/thousands of synthetic training images for object detection models.

$ python create.py

Output images will be placed in the TrainingData/ subfolder once done.

Args

These are the available entrypoint arguments that you can supply at runtime. More will be added in the future.

  • --backgrounds: Path to folder of background images.
  • --objects : Path to folder of object images.
  • --output : Path to folder of output images.
  • --groups : Whether or not to place groups of objects together.
  • --annotate : Whether or not to create and save annotations for the new images.
  • --sframe : Whether or not to create a Turi Create SFrame for modeling.
  • --mutate : Perform mutatuons to objects (rotation, brightness, shapness, contrast)

synthetic-images's People

Contributors

tylerhutcherson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

synthetic-images's Issues

annotations xml

Hello there
first of all: thank you for your script.

now: i am able to generate images with my object (drone) on different backgrounds.
now: i need the xml annotation files. is it possible to automatically generate these?

thank you*

Help - Crashes happening a few hundred images in.

I'm getting about 300 images into generating them and then I consistently get this error

Traceback (most recent call last):
  File "create.py", line 134, in <module>
    obj_h, obj_w, x_pos, y_pos = get_obj_positions(obj=obj_img, bkg=bkg_img, count=count_per_size)            
  File "create.py", line 51, in get_obj_positions
    x_positions.extend(list(np.random.randint(0, max_x, count)))
  File "mtrand.pyx", line 746, in numpy.random.mtrand.RandomState.randint
  File "_bounded_integers.pyx", line 1254, in numpy.random._bounded_integers._rand_int64
ValueError: low >= high

Is there anything I can do to debug this? I assume I have a bad image somewhere but don't know what would be wrong with it
Thanks.

annotations wrong

Hello brother, thank you for this script. But I found an error in the object annotation, where the box labels don't match their proper position. I think the algorithm for determining annotation coordinates is incorrect. Can you help me?

Getting a error while executing code

Making synthetic images.
Traceback (most recent call last):
File "/home/vk/synthetic-images/create.py", line 134, in
obj_h, obj_w, x_pos, y_pos = get_obj_positions(obj=obj_img, bkg=bkg_img, count=count_per_size)
File "/home/vk/synthetic-images/create.py", line 51, in get_obj_positions
x_positions.extend(list(np.random.randint(0, max_x, count)))
File "mtrand.pyx", line 748, in numpy.random.mtrand.RandomState.randint
File "_bounded_integers.pyx", line 1247, in numpy.random._bounded_integers._rand_int64
ValueError: high <= 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.