Skip to content

alix-tz/GT_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GT_generator

What is GT_generator

GT_generator helps generating ground truth for dhSegment. It intends to complete the last step of the creation of ground truth, as explained in the documentation. scripts to create ground truth for dhsegment

Requirements

This script requires the installation of the openCV python library. It is also meant to complement usage of dhSegment.

How to run GT_generator

Following dhSegment tutorial, you will most likely end up, for a single annotated image, with multiple black and white masks (one per class of annotation). In order to create proper ground truth, you will need to color each mask according to their class and to combine these masks all together.

1. assign each class a color

In class_color.py, the variable my_classes stores information on each class:

  • the name
  • the associated BGR color
  • a number corresponding to its z-order (similar to CSS's z-index)
my_classes = {
    "<name>":{
        "color": [<B-value>,<G-value>,<R-value>],
        "order": <z-order>}
}

2. color and combine masks

generate_gt.py uses information provided in class_color.py to organize layers in the desired order and assigne each new layer a color.

It takes up to three arguments:

  • -i: is required, and provides the absolute path to the directory containing original mask images
  • -o: is not required, and allows the user to specify the destination of the final in the form of an absolute path. Default output destination is {input_path}/combined/combined.png.
  • --test: activates test mode which will display various informative messages during the execution of the script.

WARNING : masks are expected to have been created using the script provided as an example in dhSegment documentation on annotation, so the script will expect the name of the mask's class to be indicated in the name of the image file.

python generate_gt.py -i path/to/input -o /path/to/output

Run GT_Generator recursively

recursive_generate_gt.py is a simple script designed to apply generate_gt.py recursively on a list of directories provided in the "list_of_dirs" variable.

You can adapt generate_gt.py's' mode of execution when calling subprocess.run() function (see subprocess documentation).

About

scripts to create ground truth for dhsegment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages