r15 - 02 Nov 2010 - 15:32:00 - FredericBastienYou are here: TWiki >  Public Web  > BabyAIShapesDatasets

Baby AI Shape Datasets

The reference task is to distinguish between 3 basic shapes in 32x32 home-made images with one shape and random uniform colors (one for the shape, one for the background). Intra-class variabilities involve: color, position, size, and orientation.

Download

The following tarball contains all the datasets used for our Baby AI experiments on a single shape. It contains one python file for each dataset that can be used to generate it and view it. The numpy and pygame package is required and python >= 2.4.3. The data generated will be the same everytime, so you can keep only the python files to save space when you aren't experimenting on the data.

  • shapeset.tar.gz: All the datasets for Baby AI with only one shape at a time (32x32, 8 colors).
    • This is a new version that fix syntax problem with newer python version.

Generating the dataset

First, download the tarball. Then go to the directory where you put it and unpack it. Each python file represents a dataset and comes along with a directory containing the whole python codebase, to ensure exact reproducibility of the dataset, considering that the main codebase is constantly being modified and that it could break the way the random sequence is used.

$ tar -zxf shapeset.tar.gz
$ ls
...
shapeset1_1cspo_2_3.5000.test_code
shapeset1_1cspo_2_3.5000.test.py
...
$

You have to generate each dataset individually. Let's pick the shapeset1_1cspo_2_3.5000.test dataset, which contains 5000 images of squares, circles and triangles with random colors, size, position and orientation (see the Filenames section). To generate the dataset, you find the corresponding python file (it's the dataset's name with a .py extension) and you run it with the arguments write_formats amat.

$ python shapeset1_1cspo_2_3.5000.test.py write_formats amat
.........|.........|.........|.........|.........|.........|.........|.........|.........|.........|done
$ ls -lh
...
-rw-------  1 breuleuo neurones  24M Jan  8 14:20 shapeset1_1cspo_2_3.5000.test.amat
drwx------  2 breuleuo neurones 4.0K Jan  8 14:19 shapeset1_1cspo_2_3.5000.test_code
-rw-------  1 breuleuo neurones  462 Oct 26 15:54 shapeset1_1cspo_2_3.5000.test.py
...
$

This might take a certain time depending on how many examples you have to generate.

The .amat file is an ascii format. The value separator is the space (ascii code 0x20) It is organized as follows:

  • The first line is the number of examples and the number of values per line (1031).
  • On each subsequent line, the first 1024 values represent the gray tone of each pixel (or the color, depending on how you interpret it) as a floating point value between 0 and 1, inclusively (32 lines of 32 pixels). The next 7 values are:
  • The shape: 0=rectangle, 1=ellipse and 2=triangle
  • The color of the shape: this is actually an integer between 0 and 7. Divide by 7 to get the corresponding gray tone.
  • The x coordinate of the centroid of the shape, between 0 (leftmost) and 256 (rightmost).
  • The y coordinate of the centroid of the shape, between 0 (top) and 256 (bottom).
  • The rotation angle of the shape, between 0 (no rotation) and 256 (full circle). This can probably not be learnt reliably because there the reference point is ambiguous (for instance, there is currently no way to know relatively to which side the triangle was rotated).
  • The size of the shape, between 0 (a point) and 256 (the whole area). There is a lower bound and an upper bound.
  • The elongation of the shape, between 0 (at least twice as wide as tall) and 256 (at least twice as tall as wide).

Viewing the data

You can easily view the images in the dataset. For example, if you want to view the shapeset1_1cspo_2_3.5000.test dataset:

$ python shapeset1_1cspo_2_3.5000.test.py view
0 ['tri', 5, 0.4921875, 0.38671875, 109, 0.28125]

1 ['tri', 5, 0.40625, 0.328125, 341, 0.23046875]

2 ['ell', 2, 0.34375, 0.44140625, 80, 0.265625]
q
$ 

A window will pop up with a color image of the first shape, then you can press enter in the terminal window to view the next one. The terminal also prints out the description of the image (#, shape, color index, xpos, ypos, angle (/360), size). If you want to view images n0, n1, n2, ... directly you can add them to the call as such: view <n0> <n1> ....

For easier viewing, the images are shown in a higher resolution than the resolution of the images in the .amat file (200x200 vs 32x32). If you wish, you can view a 32x32 image by adding x_res_view=32, y_res_view=32 in the python file as arguments to the dataset(...) call (sorry, I know it should be a command-line argument).

You do not have to write an amat file to view the data.

Interpreting the filenames

The filenames are a bit cryptic. Their format is shapesetA_1B_2C_3D.E.F.*.

  • A is 1 if the shapes are as wide as they are tall (square, circle, equilateralish triangle). It is 2 if we can have rectangles, ellipses and arbitrary triangles.
  • B lists free parameters, i.e. those that take a wide range of values.
  • C lists constrained parameters, i.e. those that only jitter around a fixed value (slight noise).
  • D lists fixed parameters, i.e. those that never change.
  • E is the number of examples.
  • F is a tag, valid, test or train, and it gives a hint on how the data is used (you can of course use it however you like).

Here is a comprehensive table:

Data Basename Shapes Free parameters Constrained prms Fixed prms
shapeset1_1c_2s_3po circle square triangle color size position, orientation
shapeset2_1c_2s_3po ellipse rectangle triangle color size position, orientation
shapeset1_1cs_2p_3o circle square triangle color, size position orientation
shapeset2_1cs_2p_3o ellipse rectangle triangle color, size position orientation
shapeset1_1csp_2o_3 circle square triangle color, size, position orientation  
shapeset2_1csp_2o_3 ellipse rectangle triangle color, size, position orientation  
shapeset1_1cspo_2_3 circle square triangle color, size, position, orientation    
shapeset2_1cspo_2_3 ellipse rectangle triangle color, size, position, orientation    

Reference tasks

Currently, the two reference tasks are shape recognition task, with freedom for the color, the position and the size of the object:

  • ShapeSet1: Differentiating circles, squares and equilateral triangles (canonical shapes)
  • ShapeSet2: Differentiating ellipsis, rectangles and triangles

-- OlivierBreuleux - 08 Jan 2008 -- JeromeLouradour - 25 Aug 2008 -- FredericBastien - 20 Jul 2010

toggleopenShow attachmentstogglecloseHide attachments
Topic attachments
I Attachment Action Size Date Who Comment
elsegz all.tar.gz manage 9090.0 K 08 Jan 2008 - 15:22 OlivierBreuleux All the datasets for BabyAI? with only one shape at a time (32x32, 8 colors).
elsegz shapeset.tar.gz manage 3223.8 K 02 Nov 2010 - 15:32 FredericBastien Version that work with newer python version and print error for some buggy numpy version
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r15 < r14 < r13 < r12 < r11 | More topic actions
Public.BabyAIShapesDatasets moved from Public.BabyAIDatasets on 25 Aug 2008 - 20:15 by DumitruErhan - put it back
 
Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback