{"id":38602355,"url":"https://github.com/alix-tz/gt_generator","last_synced_at":"2026-01-17T08:34:49.328Z","repository":{"id":148415789,"uuid":"172107814","full_name":"alix-tz/GT_generator","owner":"alix-tz","description":"scripts to create ground truth for dhsegment","archived":false,"fork":false,"pushed_at":"2019-04-16T09:10:19.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T04:05:48.032Z","etag":null,"topics":["dhsegment","image-generation","opencv","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alix-tz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-22T17:34:58.000Z","updated_at":"2020-01-12T23:58:23.000Z","dependencies_parsed_at":"2023-05-20T01:15:41.899Z","dependency_job_id":null,"html_url":"https://github.com/alix-tz/GT_generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alix-tz/GT_generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alix-tz%2FGT_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alix-tz%2FGT_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alix-tz%2FGT_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alix-tz%2FGT_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alix-tz","download_url":"https://codeload.github.com/alix-tz/GT_generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alix-tz%2FGT_generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dhsegment","image-generation","opencv","python"],"created_at":"2026-01-17T08:34:49.234Z","updated_at":"2026-01-17T08:34:49.305Z","avatar_url":"https://github.com/alix-tz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GT_generator\n\n## What is GT_generator\nGT_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](https://dhsegment.readthedocs.io/en/latest/start/annotating.html).\nscripts to create ground truth for dhsegment\n\n## Requirements\nThis script requires the installation of the [openCV python library](https://opencv.org/). It is also meant to complement usage of [dhSegment](https://dhsegment.readthedocs.io/en/latest/index.html).\n\n## How to run GT_generator\nFollowing 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.\n\n### 1. assign each class a color\nIn `class_color.py`, the variable `my_classes` stores information on each class:\n- the name\n- the associated **BGR** color\n- a number corresponding to its z-order (similar to CSS's z-index)\n\n``` \nmy_classes = {\n    \"\u003cname\u003e\":{\n        \"color\": [\u003cB-value\u003e,\u003cG-value\u003e,\u003cR-value\u003e],\n        \"order\": \u003cz-order\u003e}\n}\n```\n\n### 2. color and combine masks\n`generate_gt.py` uses information provided in `class_color.py` to organize layers in the desired order and assigne each new layer a color.\n\nIt takes up to three arguments:\n- `-i`: is required, and provides the absolute path to the directory containing original mask images\n- `-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`.\n- `--test`: activates test mode which will display various informative messages during the execution of the script.\n\n**WARNING** : masks are expected to have been created using the script provided as an example in [dhSegment documentation on annotation](https://github.com/dhlab-epfl/dhSegment/blob/04ce8b6db9a3fef3840c7fbbb8e65950851a3355/doc/start/annotating.rst), so the script will expect the name of the mask's class to be indicated in the name of the image file.\n\n``` shell\npython generate_gt.py -i path/to/input -o /path/to/output\n```\n\n## Run GT_Generator recursively\n`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. \n\nYou can adapt **generate_gt.py**'s' mode of execution when calling `subprocess.run()` function (see [subprocess documentation](https://docs.python.org/3.6/library/subprocess.html#subprocess.run)).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falix-tz%2Fgt_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falix-tz%2Fgt_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falix-tz%2Fgt_generator/lists"}