julienstark / nuts_detect

Add various object to various background for artificial dataset increase.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nuts_detect

Simple project to merge and display one background image with several object images by defining specific regions of interest (ROI) on the former.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them. Python3 libraries are in requirements.txt for easy installation with pip.

  • Linux >= 4.17.11
  • Bash >= 4.4.23
  • Python >= 3.7.0
  • Numpy >= 1.15.0
  • opencv-python >= 3.4.2.17

Earlier program/package versions might work too but haven't been tested.

Installing

A step by step series of examples that tell you how to get a development env running.

Simply clone the repository and ensure that you're on the master branch.

git clone https://github.com/eamsjulien/nuts_detect.git ; cd nuts_detect ; git checkout origin/master

Create imgs/data/ folders on the main project path.

mkdir -p imgs/data/gen
mkdir -p imgs/data/mask
mkdir -p imgs/data/backgrounds
mkdir -p imgs/data/nuts

Create txt/ folder on the main project path.

mkdir txt

Ensure that the background image are populated in imgs/data/backgrounds. Ensure that the nuts (objects) images are populated in imgs/data/nuts.

Ensure that the ND_DSET_FOLDER is corresponding to the location where you will launch the launch.sh script. Ensure that other environment variables are accurate as well (resize, class, etc).

cd src ; vim setup_env.sh

And good to go !

Running

This section will introduce a quick way to get the program running:

./launch.sh --number 10 --iter 10 --scale 0.25 --threshold 30 --filename 'test_bg'

Replace the first 10 by the number of objects you would like to merge with the base image. Replace the iter value by the number of images you would like to generate. Replace 0.25 by the scaling effect you would like to put on all merged image. Recommendation is to keep 0.25. Replace the second 50 by the threshold value you would like to apply when creating object mask for merging. Replace test_bg by the filename of the image you would like to save (without extension).

Output images will appear in imgs/data/gen, output masks in imgs/data/mask and output txt in /txt.

About

Add various object to various background for artificial dataset increase.


Languages

Language:Python 92.9%Language:Shell 7.1%