Skip to content

schwabdidier/grid_generation

 
 

Repository files navigation

Grid_Generator

Grid Generator is a tool for creating optimal Pictogram Grid Communication Systems, written by Carlos Vargas and supervised by Didier Schwab, Phd. It was originally designed as a Jupyter Notebook but was eventually adapted as a python script. It is a framework that allows to read, modify and evaluate pictogram grids and implements a Machine Learning algorithm (genetic algorithm) to find the best performing grids. The metric used to evaluate the grids is the cost of producing a sentence given as input. This metric as well as the code to compute the distance between each pictogram within a grid were designed in another project. This code has been improved and adapted to our particular needs.

For more technical information, consult the documentation.

Installation

You need to have installed a recent version of python (3.x). To install the other dependencies, you can run the install_all.sh file in your console, assuming you are in the same directory as the requirements.txt file.

./install_all.sh

You can also check out the specific dependencies in requirements.txt

Usage

To launch the program, you can use the next command signature in your console:

python gridGenerator.py [-f SOURCES_LIST] [-s SENTENCE] [-nl NB_LINES] [-nc NB_COLS] [-th THRESHOLD] [-mi MAX_ITER]

To get extra information about the meaning of each argument, you can use the '--help' flag:

python gridGenerator.py --help

Documentation

The documentation is available here.

Known bugs

  • The function Grid.shuffle(), which recombines all the pictograms within a page, is generating an error when launched in the genetic algorithm sequence. This error is produced by the wrong update of the attributes' dictionary of the grid, which causes that several pictograms are assigned to the same position on the same page, exceeding the maximum capacity of the page.

    For this reason, this functionality was disabled and is not currently used in the program. However, the code is available in the main script for further revision.

  • The computed production cost given by the algorithm is not exactly the same as if one calculates it by hand using the output path, but it is a good approximation of the real value.

  • In some cases, the algorithm that computes the optimal path seems unable to recognize a pictogram (usually those having a destination page), this ends up in wrong path computation.

Testing et Debugging

For this purpose, I developed the function Grid.display() to conveniently visualize the structure of the grids and get a clearer idea of what is going on. It offers a human-readable way to represent the data. There is a small commented snippet of code at the end of the main() function that generates image and text files containing the critical information of all the grids belonging to the final population once the genetic algorithm has finished. The Grid.display() function is only suited for small grids due to the screen space constraints, however, it is still quite useful to debug and run tests.

Screenshots

alt text

Visualization using the Grid.display() function. The image illustrates the fusion process between the bottom-left and the upper-right grid. The result is the bottom-right grid.

alt text

Debugging the program. On top of the image, there is the path generated by the algorithm for the input sentence: 'je voyager train'. The red arrows describe this path, and the blue numbers are the cost for each step. Finally, there is the comparison between the cost obtained and the cost calculated by hand.

Author

Carlos Vargas Figueroa @CarlosVargasF.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Shell 0.2%