{"id":22881280,"url":"https://github.com/borisboc/docker_image_annotations","last_synced_at":"2026-04-29T23:32:09.138Z","repository":{"id":267362675,"uuid":"900906038","full_name":"borisboc/docker_image_annotations","owner":"borisboc","description":"Docker compose dedicated to image annotations and visualisation : to quickly deploy the needed tools to create datasets of images and annotate them.","archived":false,"fork":false,"pushed_at":"2026-02-12T13:55:05.000Z","size":269,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-12T22:37:43.740Z","etag":null,"topics":["annotation-tool","annotations","docker","docker-compose","fiftyone","labeling-tool","labelstudio","mongodb","segment-anything"],"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/borisboc.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":"2024-12-09T17:29:30.000Z","updated_at":"2026-02-12T13:55:09.000Z","dependencies_parsed_at":"2024-12-09T23:21:18.714Z","dependency_job_id":"08330c0d-e6b8-4e87-af69-a26570720e44","html_url":"https://github.com/borisboc/docker_image_annotations","commit_stats":null,"previous_names":["borisboc/docker_image_annotations"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/borisboc/docker_image_annotations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_image_annotations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_image_annotations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_image_annotations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_image_annotations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borisboc","download_url":"https://codeload.github.com/borisboc/docker_image_annotations/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_image_annotations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"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":["annotation-tool","annotations","docker","docker-compose","fiftyone","labeling-tool","labelstudio","mongodb","segment-anything"],"created_at":"2024-12-13T17:32:36.010Z","updated_at":"2026-04-29T23:32:09.132Z","avatar_url":"https://github.com/borisboc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Image Annotations\n\nThis repository is meant to help you create Docker containers dedicated to image annotations.\nCurrently, this is based on :\n * [fiftyone](https://docs.voxel51.com/index.html)\n * [label-studio](https://labelstud.io/)\n * [Segment Anything Model 2 (SAM2)](https://github.com/facebookresearch/sam2)\n \n\n## Requirements \u0026 some important remarks\n\nYou must have [docker](https://docs.docker.com/get-started/) installed. \n\nPlease note that if you installed and use [docker desktop](https://docs.docker.com/get-started/get-docker/), it starts with a context called `desktop-linux`. In this context, you can have access to GPU only with sudo privilege.\n\nIf you don't want to run with privilege, you must run [docker in rootless mode](https://docs.docker.com/engine/security/rootless/). In this case, you can switch to rootless context by running\n\n`docker context use rootless`  \n\nIf you want the containers to have access to the NVIDIA GPUs please follow the instructions given in [docker : Access an NVIDIA GPU](https://docs.docker.com/engine/containers/resource_constraints/#gpu). Briefly, you will have to install NVIDIA driver and NVIDIA container toolkit. Once done, you should be able to successfully run the following command : \n\n`docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi`\n\nIf you need sudo privilege for this command, please read the remark above (same paragraph). \n\nIf you run with rootless privilege, all the folders (volumes) that will be created with the containers (e.g. `fiftyone_data`, `label_studio_data` etc.) will NOT be owned by your current user. Which may be anoying for some usage. In this case, you may `chmod -R g+w` each folder.\n\n## Installation\n\nStart docker.\n\nClone this repository with the following command :\n\n```\ngit clone https://github.com/borisboc/docker_image_annotations.git \u0026\u0026 cd docker_image_annotations\n```\n\nCopy the example file [.env.example](.env.example) into a `.env` file : \n\n```shell\ncp .env.example .env\n```\n\nEdit the copied file `.env`. At first, just change the values of the 2 environment variables : \n```\nMONGO_INITDB_ROOT_USERNAME=YourMongoDbUsernameHere\nMONGO_INITDB_ROOT_PASSWORD=YourMongoDbPasswordHere\n```\nIn order to set a proper user name and password for the MongoDB database (used by FiftyOne). Please do **NOT** use the `@` symbol (for both username and password).\n\n\nBuild and start the containers with the following command : \n\n * If you have GPU access : \n   * `./start_gpu.sh --build`\n * Otherwise, for CPU : \n   * `./start_cpu.sh --build` \n\nIf you use Windows, you can execute the shell scripts using GitBash.\n\nOpen your web browser and and go to URL : http://localhost:8080/.\nThen log in [label-studio](https://labelstud.io/).\n\nSign-up / create an account (you have to create an account at first start if you started from empty label_studio_data volume).\n\nGet your label-studio API KEY (acces token). Somewhere in 2025, Label Studio have changed their authorization / tokens methods. But FiftyOne still uses the old method.\u003cbr\u003e\nSo you first need to go to `Organization \u003e API Tokens Settings` and activate `Legacy Tokens`. \u003cbr\u003e\nThen go to your `account \u0026 settings` page, go to `Legacy Token` section and copy the `Access Token`, and paste it inside the file `.env`.\n\n```\nLABELSTUDIO_API_KEY=\"PLEASE PASTE YOUR LABEL STUDIO ACCESS TOKEN HERE, WITHIN THE DOUBLE QUOTES\"\n```\n\nStop the containers. Please refer to dedicated paragraph bellow.\n\nRestart the containers (see docker compose command above) so that FiftyOne environment is updated.\n\n## Usage : starting the docker compose\n\nPlease make sure that installation is done. See dedicated paragraph above.\n\nStart docker.\n\nThen choose one of the following method.\n\n\n### Method 1: Traditional approach using shell scripts (.sh files)\n\nFor users who prefer the simple, straightforward approach, you can continue using the existing shell scripts:\n\nStart the containers with the following command : \n\n * If you have GPU access : \n   * `./start_gpu.sh`\n * Otherwise, for CPU : \n   * `./start_cpu.sh` \n\nYou can pass extra arguments for docker, for instance : `./start_gpu.sh -d`, `./start_gpu.sh --build`, etc.\n\nIf you use Windows, you can execute the shell scripts using GitBash.\n\n### Method 2: Modern approach using Python script (config_manager.py)\n\nThe `config_manager.py` script provides a more flexible approach to manage configurations. It allows you to combine different parameters without having to create a script file for each configuration.\n\n**Basic usage:**\n```bash\n# CPU configuration\npython config_manager.py --profile cpu\n\n# GPU configuration\npython config_manager.py --profile gpu\n```\n\n`cpu` will start all containers using CPU processor.\n\n`gpu` will start all containers using GPU processor.\n\n\n`--profile` (or simply `-p`) argument is a list : you can concatenate several profile to create your own custom network of containers.\n\nFor instance, if you just want to start FiftyOne and your mongodb server (where your FiftyOne datasets are stored) :\n\n```bash\n# Just starting fiftyone and mongodb in the compose, thanks to profiles\npython config_manager.py --profile mongodb cpu-fiftyone\n```\n\nWhat to know which profiles are available, here is how to list :\n\n```bash\n# List available profiles in the compose file\npython config_manager.py --list-profiles\n```\n\nAnd for all available arguments with default values :\n\n```bash\n# Print help including default values for arguments\npython config_manager.py --help\n```\n\n\n**Advanced options:**\n```bash\n# Use a different compose file\npython config_manager.py --compose-file compose_local_files.yaml --profile gpu\n\n# Add custom environment variables\npython config_manager.py --profile cpu --env-var \"CUSTOM_MOUNT=/path/to/data\"\n\n# Pass additional arguments to docker compose (like --build)\npython config_manager.py --profile cpu --extra-args --build\n```\n\n**Advantages of the Python method:**\n- More flexible: Combine different parameters without creating new scripts\n- Cross-platform: Works on Linux, Windows, and macOS\n- Extensible: Easy to add new parameters\n- Modular: Handles different compose files and profiles\n\n\n## Stopping the containers\n\nTo stop the containers you can do this : \n * CTRL+C in the terminal you upped the containers, since they are not started detached by default\n * calling `docker compose -f compose_local_files.yaml -p img-ann --profile gpu down` (assuming you started with the `gpu` profile, please adapt to your profile)\n * using Docker Desktop\n * using VS Code extension [Container Tools](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-containers)\n\n## Usage : how to use the different services\n\nPlease make sure that you have installed and started the containers and composition (see dedicated paragraphs above).\n\nCreate a subfolder inside folder `local_images/` with the name of your project. E.g. `local_images/myproject`. Place your images within this folder.\n\nOpen your web browser and and go to URL : http://localhost:5151/ to use the [FiftyOne App](https://docs.voxel51.com/user_guide/app.html).\n\nIf you don't have any dataset yet, you can create one by clicking on link on the webpage.\nTODO : Screenshot when creating a dataset for the first time.\n\nThen you can add samples by clicking on the link `click here` on the webpage.\n\n![Add samples to an empty dataset by clicking on the link](doc/add_samples_to_empty_dataset.png)\n\nChoose what you want to import. It depends on your data : if you have only media (i.e. the images) or you also have the annotations. For more details, you can refere to [FiftyOne import_samples operator](https://github.com/voxel51/fiftyone-plugins/blob/main/plugins/io/README.md#import_samples).\n\n![Choose the type of samples to import](doc/samples_import_type.png)\n\nThen import either all the content of a directory (but not the subdirectories recursively). Or using a glob pattern.\nIn both cases, your images will be in the folder `/home/local_images` as there is a binding between the container and the folder on your host machine.\nIn the case you want to browse the folder with the FiftyOne Web App, see the screenshots bellow.\n\nAccess the root directory by clicking on the arrow up close to the text bar.\n![root directory accessed with arrow up](doc/root_directory.png)\n\nThen go to your directory containing your media. E.g., if your subfolder is named `myproject` (as proposed above), you will find it at the path `/home/local_images/myproject` \n\n![folder myproject at path /home/local_images/myproject](doc/local_images_directory.png).\n\nThen press execute.\n\nFrom now you have a dataset created, and some samples. You can see the subparagraphs of this readme depending on what you want to do next.\n\n\u003cbr\u003e\n\nYou need more tips and tricks specific to FiftyOne ? Please look at the dedicated file : [TIPS_FIFTYONE](TIPS_FIFTYONE.md)\n\n### Workflow for annotations\n\nCAUTION : annotation name (also call `anno_key`) cannot start with numbers ! E.g. `20250724_ann_key` is **NOT** valid !\n\nAnd then request for annotations with Label-Studio backend.\n\nTODO : finish this paragraph and add screenshots.\n\n\u003cbr\u003e\n\nYou need more tips and tricks specific to FiftyOne ? Please look at the dedicated file : [TIPS_FIFTYONE](TIPS_FIFTYONE.md)\n\n\n### Using Segment Anything Model 2 during annotations\n\nDuring annotations on Label-Studio, if you need to annotate segmentation (e.g. semantic segmentation, or instance segmentation) you can use Segment Anything Model 2 ([SAM2](https://github.com/facebookresearch/sam2)) to generate you segmentations/masks from a provided seed on the image (which can be some keypoints, a brushed region, or a axis-aligend rectangle). The result of SAM2 will be `BrushLabel`.\n\nYou can find a [youtube video tutorial](https://youtu.be/FTg8P8z4RgY?feature=shared) from Label Studio, to show you how to use SAM2.\n\nConcerning the configuration in the menu `Settings \u003e Model`, in our case, please set the following Backend URL : \n\n```\nhttp://img-ann-sa2-label-studio:9090\n```\n\nAnd toggle ON the parameter `Interactive preannotations`.\n\nFor further details, please refer to [label-studio-ml-backend github : using sam2](https://github.com/HumanSignal/label-studio-ml-backend/tree/master/label_studio_ml/examples/segment_anything_2_image#using-sam2-with-label-studio-for-image-annotation)\n\nRemark : for keypoints, add a \"belong to\" point with left click, and a \"does not belong to\" with ALT + left click. \n\nFor the labeling interface, you use SAM2 with keypoints or rectangle, you can base it on the example in [labeling_interface_sam2.xml](PythonUtils/labeling_interface_sam2.xml)\n\n### Connect another instance of FiftyOne to the same database\n\nBecause the MongoDB database used by FiftyOne runs in its own container, and ports are bound, it is fine to connect another instance of FiftyOne to this database. The typical use case is that you develop a neural network on your host machine, or inside another container, and you want to access the samples in one of your FiftyOne dataset.\n\nDo do so, in the session running your own FiftyOne instance, you can either modify the fiftyone configuration json file, or declare the environment variable `FIFTYONE_DATABASE_URI`, which is the preferred option explained bellow.\n\nIn your session, please export : \n\n```\nexport FIFTYONE_DATABASE_URI=mongodb://YourMongoDbUsernameHere:YourMongoDbPasswordHere@127.0.0.1:27017\n```\n\nPlease set the correct values for your mongodb username and password. They must match the content in file [fiftyone_image/fiftyone_secrets.env](fiftyone_image/fiftyone_secrets.env)\n\n\nOnce exported, you can run all your python codes with FiftyOne and access the FiftyOne datasets. E.g. :\n\n``` python\nimport fiftyone as fo\nds = fo.load_dataset(\"NameOfYouDatasetHere\")\n```\n\nA convenient way is to save this command with the correct connection details within a `.sh`file. And you can `source` this file.\n\n\u003cbr/\u003e\n\nIf your FiftyOne session is within another container, please :\n * place your container on the same docker network, i.e. `img-ann-net`. If you are on a different docker compose file, you have to declare this network as external. Here is the snippet : \n\n```\nnetworks:\n  img-ann-net:\n    name: img-ann-net\n    external: true\n```\n\n * use the mongodb container name. E.g. :\n```\nexport FIFTYONE_DATABASE_URI=mongodb://YourMongoDbUsernameHere:YourMongoDbPasswordHere@img-ann-mongodb:27017\n```\nThis is what is done in file [fiftyone_image/fiftyone.env](fiftyone_image/fiftyone.env)\n\n\nFor further details, please refere to [FiftyOne : configuring mongodb connection](https://docs.voxel51.com/user_guide/config.html#configuring-mongodb-connection).\n\n\u003cbr/\u003e\n\nYou need more tips and tricks specific to FiftyOne ? Please look at the dedicated file : [TIPS_FIFTYONE](TIPS_FIFTYONE.md)\n\n\n### Accessing a container, program with jupyter notebook\n\n#### For label-studio container\n\nTo start a jupyter notebook server on the label-studio container, simply start a new terminal and run : \n\n```\n./jupyter_label_studio.sh\n```\n\nYou will see the URL with the AUTH token printed in the console. Go to this URL on the web browser to work with jupyter notebook. For instance, you may want to use the scripts that are in `PythonUtils/` folder.\n\n#### For fiftyone container\n\nSame as for label-studio container, but instead you may run :\n\n```\n./jupyter_fiftyone.sh\n```\n\n\n#### For other containers\n\nYou can use Visual Studio Code remote connexion on a `Dev Container`. Or `Docker Desktop`.\nConnect on the container you want to play with (let's say `img-ann-fiftyone` ).\nInside a container terminal, go to relevant folder. E.g. `/home/local_images/` , then type\n\n```\njupyter notebook --ip 0.0.0.0 --no-browser --allow-root\n```\nClick on the link provided in the terminal output to start a notebook.\n\n\n\n### Managing Fiftyone one plugins\n\nOnce the container started, you can fully call the `fiftyone plugins` CLI on the container, for instance :\n\n```bash\ndocker exec -it img-ann-fiftyone fiftyone plugins list\n```\n\n\n\n## Sources\n\n[label-studio on dockerhub](https://hub.docker.com/r/heartexlabs/label-studio)\n\n[label-studio : persist data with Docker](https://labelstud.io/guide/storedata#Persist-data-with-Docker)\n\n[label-studio tuto import yolo annotations](https://labelstud.io/blog/tutorial-importing-local-yolo-pre-annotated-images-to-label-studio/)\n\n[label-studio local storage](https://labelstud.io/guide/storage.html#Set-up-connection-in-the-Label-Studio-UI-4)\n\n[label-studio-ml-backend github : using sam2](https://github.com/HumanSignal/label-studio-ml-backend/tree/master/label_studio_ml/examples/segment_anything_2_image#using-sam2-with-label-studio-for-image-annotation)\n\n[Access Jupyter notebook running on Docker container](https://stackoverflow.com/questions/38830610/access-jupyter-notebook-running-on-docker-container)\n\n[FiftyOne on dockerhub](https://hub.docker.com/r/voxel51/fiftyone)\n\n[FiftyOne : Loading data into FiftyOne](https://docs.voxel51.com/user_guide/dataset_creation/index.html#)\n\n[FiftyOne : Using the FiftyOne App](https://docs.voxel51.com/user_guide/app.html)\n\n[FiftyOne : configuring mongodb connection](https://docs.voxel51.com/user_guide/config.html#configuring-mongodb-connection)\n\n[Docker and MongoDB](https://www.mongodb.com/resources/products/compatibilities/docker)\n\n[docker : Access an NVIDIA GPU](https://docs.docker.com/engine/containers/resource_constraints/#gpu)\n\n\n## TODOs\n\nScreenshot when creating a dataset for the first time.\n\nMore documentation and more screenshots.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborisboc%2Fdocker_image_annotations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborisboc%2Fdocker_image_annotations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborisboc%2Fdocker_image_annotations/lists"}