GithubHelp home page GithubHelp logo

debidatta / syndata-generation Goto Github PK

View Code? Open in Web Editor NEW
285.0 285.0 71.0 6.6 MB

Code used to generate synthetic scenes and bounding box annotations for object detection. This was used to generate data used in the Cut, Paste and Learn paper

Home Page: https://arxiv.org/abs/1708.01642

License: MIT License

Python 100.00%
data-augmentation faster-rcnn instance-detection object-detection synthetic-data

syndata-generation's People

Contributors

akindofyoga avatar debidatta 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar

syndata-generation's Issues

3D Rotation

In the paper, you mention rotating images in 3D, however, I only see 2D rotation implemented in this repo, in lines 305-306:

foreground_tmp = foreground.rotate(rot_degrees, expand=True)
mask_tmp = mask.rotate(rot_degrees, expand=True)

Is this correct that only 2D rotation is implemented here? Is 3D rotation achieved some other way?

".pbm" and "Foreground/Background segmentation:"

Thanks for sharing the code base!

In the paper, section:
5. Approach Details and Analysis -> Foreground/Background segmentation:
"We train a FCN network [28] (based on VGG-16 [44] pre-trained on PASCAL VOC [8] image segmentation) to classify each image pixel into foreground/background...."

Does it mean that to obtain the mask files like "NP1_123.pbm", we can:

  1. Train it on a "FCN network...", just like you mentioned in the paper.
  2. Use "Pixel Objectness with Bilinear Filtering" or "Grabcut"(mentioned in the prerequisite of the repo)?

Sorry, I am a newbie and just couldn't find out how is the FCN network related to this repo.

Thanking you in advance!

Demo Data Directory Structure

Thanks for the amazing work! Can you please help me understand the data structure directory within demo directory
image

Error in line 451. unbound local error

File "C:\Users\SurajBharadwaj\Downloads\syndata-generation-master\syndata-generation-master\dataset_generator.py", line 487, in generate_synthetic_dataset
syn_img_files, anno_files = gen_syn_data(img_files, labels, img_dir, anno_dir, args.scale, args.rotation, args.dontocclude, args.add_distractors)

File "C:\Users\SurajBharadwaj\Downloads\syndata-generation-master\syndata-generation-master\dataset_generator.py", line 451, in gen_syn_data
p.map(partial_func, params_list)

File "C:\Users\SurajBharadwaj.conda\envs\tgpu\lib\multiprocessing\pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()

File "C:\Users\SurajBharadwaj.conda\envs\tgpu\lib\multiprocessing\pool.py", line 657, in get
raise self._value

UnboundLocalError: local variable 'attempt' referenced before assignmen

background images

first, thank you for your contribution.

for reserch propose i want to restore your experment that you have done in your article.

i have an difficulty to find the background images dataset that you are using in order to pasted the objects on them.
in the article i saw that you use this dataset: from this paper
there is a lot of background images there and not 1548 like you wrote in the paper and also the look a little diffrent from the examples in the paper.
can you give me the link of the background image dataset ?
thanks

mask process

Can you share the process of generating mask for images?
the code and steps in detail

it would be of great help

Only uses one background at a time

if i want to use 20 backgrounds for each object, how can i use your code?
I observe i have to give command 20 time for my requirement which is not feasible

unable to reproduce results

Hi, thanks for your repo!

I would like to reproduce your results for Table1 last row (76.2). And here is what I did. I run your code with

python dataset_generator.py /path/to/BigBird /path/to/exp --selected --add_distractors

where selected is all 11 objects in the BigBird overlapping with UW Scene,
image
and neg_list is all others
image
and in defaults.py the BACKGROUND_DIR is set to be the path to the 1548 images in the UW Scene (extracted from the background.tar)

I didn't change other settings in the defaults.py and use all different blendings (5 in total, ['gaussian','poisson', 'none', 'box', 'motion'])

Is my setting correct? In the end I created 2632 annotation xml, and 2632 * 5 = 13160 images (with 5 blendings).

## local variable 'attempt' referenced before assignment

dataset_generator.py", line 514, in <module>
    generate_synthetic_dataset(args)
  File "dataset_generator.py", line 486, in generate_synthetic_dataset
    syn_img_files, anno_files = gen_syn_data(img_files, labels, img_dir, anno_dir, args.scale, args.rotation, args.dontocclude, args.add_distractors)
  File "dataset_generator.py", line 450, in gen_syn_data
    p.map(partial_func, params_list)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 253, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
UnboundLocalError: local variable 'attempt' referenced before assignment

How did you get the .pbm pictures?

Thanks for your work! But as a beginner, I have no idea how to generate the .pbm pictures in the objects_dir folder. I could just got a few by using Photoshop. But it's too slow.
So could you please tell me some better ways that you've used? Thank you very much!

Applicability of code in 2D images and backgrounds

Hi
while i ran demo successfully for the images provided in code, when i gave my own back ground image ( .png file 640x480), i got error
Number of background images : 1
[('demo_data_dir/distractor_objects_dir/nature_valley\NP1_234.jpg', None), ('demo_data_dir/distractor_objects_dir/nature_valley\NP2_123.jpg', None)] [('demo_data_dir/distractor_objects_dir/nature_valley\NP2_123.jpg', None), ('demo_data_dir/distractor_objects_dir/nature_valley\NP1_234.jpg', None)]
[('demo_data_dir/distractor_objects_dir/nature_valley\NP2_123.jpg', None), ('demo_data_dir/distractor_objects_dir/nature_valley\NP1_234.jpg', None)] [('demo_data_dir/distractor_objects_dir/nature_valley\NP2_123.jpg', None), ('demo_data_dir/distractor_objects_dir/nature_valley\NP1_234.jpg', None)]
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\Microwave Lab.conda\envs\py38\lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "C:\Users\Microwave Lab.conda\envs\py38\lib\multiprocessing\pool.py", line 48, in mapstar
return list(map(*args))
File "D:\JCodeExp\cutpaste\syndata-generation-master\datasetgenerator2.py", line 260, in create_image_anno_wrapper
return create_image_anno(*args, w=w, h=h, scale_augment=scale_augment, rotation_augment=rotation_augment,
File "D:\JCodeExp\cutpaste\syndata-generation-master\datasetgenerator2.py", line 360, in create_image_anno
img_target = PIL2array3C(backgrounds[i])
File "D:\JCodeExp\cutpaste\syndata-generation-master\datasetgenerator2.py", line 252, in PIL2array3C
return np.array(img.getdata(),
ValueError: cannot reshape array of size 1228800 into shape (480,640,3)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "datasetgenerator2.py", line 538, in
generate_synthetic_dataset(args)
File "datasetgenerator2.py", line 506, in generate_synthetic_dataset
syn_img_files, anno_files = gen_syn_data(img_files, labels, img_dir, anno_dir, args.scale, args.rotation,
File "datasetgenerator2.py", line 468, in gen_syn_data
p.map(partial_func, params_list)
File "C:\Users\Microwave Lab.conda\envs\py38\lib\multiprocessing\pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "C:\Users\Microwave Lab.conda\envs\py38\lib\multiprocessing\pool.py", line 771, in get
raise self._value
ValueError: cannot reshape array of size 1228800 into shape (480,640,3)
Working on output_dir\images\1_none.jpg
Working on output_dir\images\2_none.jpg
(py38)
i got no output images

while i tried with different backgrounds (even with the plain ones like a white background) i got same error.
i read the paper thoroughly but i could not find anywhere if this code only applied to 3d scene generation or it can work for 2D images (normal images) ?

error discription

Error Code:
img_mask, img_src, offset_adj =
create_mask(img_mask.astype(np.float64), img_target, img_src, offset=offset)
background_array = poisson_blend(img_mask, img_src, img_target,
method='normal', offset_adj=offset_adj)
Discription:
Red wavy lines appear below create create_mask and poisson_blend,why?
I am a novice, the first contact with synthetic data, so ask for your answers, thank you!

what is the dataset Type?

Hello!

I have been able to create a nice dataset thanks to your project. But I need to modify the annotation to have a COCO format. I tried a couple of algorithms that transfer VOC format to COCO, but the annotation from your algorithm doesn't seem to match perfectly the VOC standard.

So, I was wondering what is your annotation template and if you know how to modify it to obtain a COCO format?

Thank you!

Error when running with defaults.

I'm having a little bit of trouble getting started. I'm running this project on Ubuntu 16.04 and I believe that I have all the required dependencies. When I try to run python3 dataset_generator.py I am met with File "dataset_generator.py", line 151 print "%s not found. Using empty mask instead."%mask_file ^ SyntaxError: Missing parentheses in call to 'print'

Any idea why. I am probably missing something really simple, but any help would be very much appreciated.

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.