imagebaker 0.0.48__tar.gz → 0.0.49__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. imagebaker-0.0.49/.github/workflows/black-formatter.yml +31 -0
  2. imagebaker-0.0.49/.github/workflows/pypi.yml +75 -0
  3. imagebaker-0.0.49/.gitignore +170 -0
  4. imagebaker-0.0.49/CHANGELOG.md +26 -0
  5. {imagebaker-0.0.48 → imagebaker-0.0.49}/PKG-INFO +1 -1
  6. imagebaker-0.0.49/TODO.md +26 -0
  7. imagebaker-0.0.49/assets/demo/annotated_veg_smiley.png +0 -0
  8. imagebaker-0.0.49/assets/demo/annotation_page.png +0 -0
  9. imagebaker-0.0.49/assets/demo/baker_page.png +0 -0
  10. imagebaker-0.0.49/assets/demo/drawing.png +0 -0
  11. imagebaker-0.0.49/assets/demo/options.png +0 -0
  12. imagebaker-0.0.49/assets/demo.gif +0 -0
  13. imagebaker-0.0.49/assets/desk.png +0 -0
  14. imagebaker-0.0.49/assets/favicon_io/README.md +1 -0
  15. imagebaker-0.0.49/assets/favicon_io/android-chrome-192x192.png +0 -0
  16. imagebaker-0.0.49/assets/favicon_io/android-chrome-512x512.png +0 -0
  17. imagebaker-0.0.49/assets/favicon_io/apple-touch-icon.png +0 -0
  18. imagebaker-0.0.49/assets/favicon_io/favicon-16x16.png +0 -0
  19. imagebaker-0.0.49/assets/favicon_io/favicon-32x32.png +0 -0
  20. imagebaker-0.0.49/assets/favicon_io/favicon.ico +0 -0
  21. imagebaker-0.0.49/assets/favicon_io/site.webmanifest +1 -0
  22. imagebaker-0.0.49/assets/me.jpg +0 -0
  23. imagebaker-0.0.49/assets/pen.png +0 -0
  24. imagebaker-0.0.49/assets/veg_smiley.jpg +0 -0
  25. imagebaker-0.0.49/docs/api-reference.md +81 -0
  26. imagebaker-0.0.49/docs/index.md +87 -0
  27. imagebaker-0.0.49/examples/app.py +10 -0
  28. imagebaker-0.0.49/examples/example_config.py +9 -0
  29. imagebaker-0.0.49/examples/loaded_models.py +59 -0
  30. imagebaker-0.0.49/examples/rtdetr_v2.py +254 -0
  31. imagebaker-0.0.49/examples/sam_model.py +360 -0
  32. imagebaker-0.0.49/examples/segmentation.py +288 -0
  33. imagebaker-0.0.49/experiments/expt.ipynb +840 -0
  34. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/__init__.py +1 -1
  35. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/configs/configs.py +10 -1
  36. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/layers/annotable_layer.py +93 -15
  37. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/list_views/annotation_list.py +3 -2
  38. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/list_views/image_list.py +3 -1
  39. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/tabs/layerify_tab.py +26 -25
  40. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/window/main_window.py +3 -1
  41. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker.egg-info/PKG-INFO +1 -1
  42. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker.egg-info/SOURCES.txt +34 -0
  43. imagebaker-0.0.49/mkdocs.yml +57 -0
  44. imagebaker-0.0.49/requirements.txt +7 -0
  45. {imagebaker-0.0.48 → imagebaker-0.0.49}/setup.py +2 -1
  46. {imagebaker-0.0.48 → imagebaker-0.0.49}/LICENSE +0 -0
  47. {imagebaker-0.0.48 → imagebaker-0.0.49}/README.md +0 -0
  48. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/__init__.py +0 -0
  49. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/configs/__init__.py +0 -0
  50. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/defs/__init__.py +0 -0
  51. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/defs/defs.py +0 -0
  52. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/plugins/__init__.py +0 -0
  53. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/plugins/base_plugin.py +0 -0
  54. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/core/plugins/cosine_plugin.py +0 -0
  55. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/layers/__init__.py +0 -0
  56. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/layers/base_layer.py +0 -0
  57. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/layers/canvas_layer.py +0 -0
  58. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/list_views/__init__.py +0 -0
  59. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/list_views/canvas_list.py +0 -0
  60. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/list_views/layer_list.py +0 -0
  61. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/list_views/layer_settings.py +0 -0
  62. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/models/__init__.py +0 -0
  63. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/models/base_model.py +0 -0
  64. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/tabs/__init__.py +0 -0
  65. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/tabs/baker_tab.py +0 -0
  66. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/utils/__init__.py +0 -0
  67. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/utils/image.py +0 -0
  68. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/utils/state_utils.py +0 -0
  69. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/utils/transform_mask.py +0 -0
  70. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/window/__init__.py +0 -0
  71. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/window/app.py +0 -0
  72. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/workers/__init__.py +0 -0
  73. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/workers/baker_worker.py +0 -0
  74. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/workers/layerify_worker.py +0 -0
  75. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker/workers/model_worker.py +0 -0
  76. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker.egg-info/dependency_links.txt +0 -0
  77. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker.egg-info/entry_points.txt +0 -0
  78. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker.egg-info/requires.txt +0 -0
  79. {imagebaker-0.0.48 → imagebaker-0.0.49}/imagebaker.egg-info/top_level.txt +0 -0
  80. {imagebaker-0.0.48 → imagebaker-0.0.49}/setup.cfg +0 -0
@@ -0,0 +1,31 @@
1
+ name: Black Code Formatting
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "*" # Trigger the workflow only on tag pushes
7
+
8
+ jobs:
9
+ black:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ # Step 1: Checkout the repository code
14
+ - name: Checkout code
15
+ uses: actions/checkout@v3
16
+
17
+ # Step 2: Set up Python
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: "3.10"
22
+
23
+ # Step 3: Install Black
24
+ - name: Install Black
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install black
28
+
29
+ # Step 4: Check formatting with Black
30
+ - name: Run Black
31
+ run: black --check .
@@ -0,0 +1,75 @@
1
+ name: Build Docs and Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: # Trigger the workflow only on tag pushes
6
+ - "*" # Match all tags
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+
14
+ steps:
15
+ # Step 1: Check out the code
16
+ - name: Checkout code
17
+ uses: actions/checkout@v2
18
+
19
+ # Step 2: Set up Python
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v2
22
+ with:
23
+ python-version: '3.10'
24
+
25
+ # Step 3: Install dependencies
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install mkdocs mkdocs-material mkdocstrings
30
+ pip install -e .[docs]
31
+
32
+ # Step 4: Build documentation
33
+ - name: Build documentation
34
+ run: mkdocs build
35
+
36
+ # Step 5: Deploy to GitHub Pages
37
+ - name: Deploy to GitHub Pages
38
+ run: |
39
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
40
+ git config --global user.name "github-actions[bot]"
41
+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
42
+ mkdocs gh-deploy --force
43
+
44
+ build-and-publish:
45
+ runs-on: ubuntu-latest
46
+ if: startsWith(github.ref, 'refs/tags/') # Only run on tag pushes
47
+
48
+ steps:
49
+ # Step 1: Check out the code
50
+ - name: Checkout code
51
+ uses: actions/checkout@v3
52
+
53
+ # Step 2: Set up Python
54
+ - name: Set up Python
55
+ uses: actions/setup-python@v4
56
+ with:
57
+ python-version: "3.10"
58
+
59
+ # Step 3: Install build dependencies
60
+ - name: Install build tools
61
+ run: |
62
+ python -m pip install --upgrade pip
63
+ pip install build twine setuptools wheel setuptools-scm # Added wheel package
64
+
65
+ # Step 4: Build the distribution
66
+ - name: Build the package
67
+ run: python setup.py sdist bdist_wheel # Use setup.py
68
+
69
+ # Step 5: Publish to PyPI
70
+ - name: Publish to PyPI
71
+ env:
72
+ TWINE_USERNAME: __token__
73
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
74
+ run: |
75
+ python -m twine upload dist/*
@@ -0,0 +1,170 @@
1
+ # local files and folders
2
+ *.json
3
+ new_gui
4
+ gui
5
+ weights
6
+ RT-DETR
7
+ *.pt
8
+ exports/
9
+ # Byte-compiled / optimized / DLL files
10
+ __pycache__/
11
+ *.py[cod]
12
+ *$py.class
13
+
14
+ # C extensions
15
+ *.so
16
+
17
+ # Distribution / packaging
18
+ .Python
19
+ build/
20
+ develop-eggs/
21
+ dist/
22
+ downloads/
23
+ eggs/
24
+ .eggs/
25
+ lib/
26
+ lib64/
27
+ parts/
28
+ sdist/
29
+ var/
30
+ wheels/
31
+ share/python-wheels/
32
+ *.egg-info/
33
+ .installed.cfg
34
+ *.egg
35
+ MANIFEST
36
+
37
+ # PyInstaller
38
+ # Usually these files are written by a python script from a template
39
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
40
+ *.manifest
41
+ *.spec
42
+
43
+ # Installer logs
44
+ pip-log.txt
45
+ pip-delete-this-directory.txt
46
+
47
+ # Unit test / coverage reports
48
+ htmlcov/
49
+ .tox/
50
+ .nox/
51
+ .coverage
52
+ .coverage.*
53
+ .cache
54
+ nosetests.xml
55
+ coverage.xml
56
+ *.cover
57
+ *.py,cover
58
+ .hypothesis/
59
+ .pytest_cache/
60
+ cover/
61
+
62
+ # Translations
63
+ *.mo
64
+ *.pot
65
+
66
+ # Django stuff:
67
+ *.log
68
+ local_settings.py
69
+ db.sqlite3
70
+ db.sqlite3-journal
71
+
72
+ # Flask stuff:
73
+ instance/
74
+ .webassets-cache
75
+
76
+ # Scrapy stuff:
77
+ .scrapy
78
+
79
+ # Sphinx documentation
80
+ docs/_build/
81
+
82
+ # PyBuilder
83
+ .pybuilder/
84
+ target/
85
+
86
+ # Jupyter Notebook
87
+ .ipynb_checkpoints
88
+
89
+ # IPython
90
+ profile_default/
91
+ ipython_config.py
92
+
93
+ # pyenv
94
+ # For a library or package, you might want to ignore these files since the code is
95
+ # intended to run in multiple environments; otherwise, check them in:
96
+ # .python-version
97
+
98
+ # pipenv
99
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
101
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
102
+ # install all needed dependencies.
103
+ #Pipfile.lock
104
+
105
+ # poetry
106
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
107
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
108
+ # commonly ignored for libraries.
109
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
110
+ #poetry.lock
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ #pdm.lock
115
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
116
+ # in version control.
117
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
118
+ .pdm.toml
119
+ .pdm-python
120
+ .pdm-build/
121
+
122
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
123
+ __pypackages__/
124
+
125
+ # Celery stuff
126
+ celerybeat-schedule
127
+ celerybeat.pid
128
+
129
+ # SageMath parsed files
130
+ *.sage.py
131
+
132
+ # Environments
133
+ .env
134
+ .venv
135
+ env/
136
+ venv/
137
+ ENV/
138
+ env.bak/
139
+ venv.bak/
140
+
141
+ # Spyder project settings
142
+ .spyderproject
143
+ .spyproject
144
+
145
+ # Rope project settings
146
+ .ropeproject
147
+
148
+ # mkdocs documentation
149
+ /site
150
+
151
+ # mypy
152
+ .mypy_cache/
153
+ .dmypy.json
154
+ dmypy.json
155
+
156
+ # Pyre type checker
157
+ .pyre/
158
+
159
+ # pytype static type analyzer
160
+ .pytype/
161
+
162
+ # Cython debug symbols
163
+ cython_debug/
164
+
165
+ # PyCharm
166
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
167
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
168
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
169
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
170
+ #.idea/
@@ -0,0 +1,26 @@
1
+ ## April 2 2025
2
+ Worked on [#3](https://github.com/q-viper/image-baker/issues/3), [#4](https://github.com/q-viper/image-baker/issues/4), [#5](https://github.com/q-viper/image-baker/issues/5) and [#6](https://github.com/q-viper/image-baker/issues/6).
3
+
4
+ ## Fixed
5
+ * Handling of point movement in polygon.
6
+ * Can control the recursive image laoding or partial from config.
7
+
8
+ ## Added
9
+ * Double click on edge of polygon will add a point.
10
+ * Double click on a polygon point will remove that point.
11
+ * Can move point polygon around.
12
+
13
+ ## Removed
14
+ * Double click to select unselect annotation.
15
+
16
+ ## March 24 2025
17
+ ### Added
18
+ * Tested with Segmentation, Detection and Prompt models.
19
+ * Transformation of annotation and export.
20
+
21
+ ### Updated
22
+ * Handling of model predictions.
23
+ * Handling of draging layer.
24
+
25
+
26
+ ### Removed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imagebaker
3
- Version: 0.0.48
3
+ Version: 0.0.49
4
4
  Summary: A package for baking images.
5
5
  Home-page: https://github.com/q-viper/Image-Baker
6
6
  Author: Ramkrishna Acharya
@@ -0,0 +1,26 @@
1
+ Highest Priority First
2
+ ----------------------
3
+ - [ ] Define a plugin method. Try to implement smokesim here.
4
+ - [x] Instead of defining everything on app.py, use different file for each tab. Try to abstract more generic things in Base classes and inherit them.
5
+ - [ ] Merging two layers
6
+ - [ ] A small dropdown on the layers list that toggles what annotation to export for this layer. Should be options: Default, Rectangle, Polygon.
7
+ - [ ] Occlusion handling.
8
+ - [ ] Instead of separate prompt model class, use a flag in the config. If a prompt is allowed, the prompt will be sent to the model else the propmt will be applied on the image i.e. if passed rectangle for non prompt segmentation model, model will receive cropped image.
9
+ - [ ] Add test scripts (to reproduce results if that is even possible).
10
+ - [ ] How to work with OCR? i.e. generating the image data with text on it.
11
+ - [ ] Add color picker from the active QWidget.
12
+ - [ ] Drawing with color.
13
+ - [ ] Layerifying the drawing.
14
+ - [ ] Option to show gridlines. Only if it does not affect the performance much.
15
+ - [ ] Add Circle mode. Now, we only have point, rectangle and polygon.
16
+ - [ ] Loading of video?
17
+ - [ ] Add pose annotation.
18
+
19
+
20
+ - [x] Copy pasting selected layer/annotation with ctrl+c ctrl+v.
21
+ - [x] Updating of annotation i.e. scaling for rectangle, moving point for polygon with cursors.
22
+ - [x] Mouse events should be same for both layers i.e. hot keys to pan, zoom select layer/annotation.
23
+ - [x] Use LayerSettings properly i.e. should be able to see layer's transformation in slider. Upon moving those sliders, layer should show the changes too. Emit the settings and update the Layer. But could be slower based on the step size.
24
+ - [x] A checkbox to toggle the layer's annotation exportation. i.e. some annotations can be skipped like for the background.
25
+ - [x] Actual baking of images has yet to be done. i.e. User should be able to click on the button called **Buffer State**. It should store the layer's settings and it's order in Canvas. Show the number of states available in buffer.
26
+ - [x] Also show the dropdown for it and upon selecting, should change the canvas. Then add another button **Bake States**. This should apply the settings from buffer state and store the baked image and annotation. Additionally, this should be able to write the baked image and annotation to defined folder.
Binary file
Binary file
@@ -0,0 +1 @@
1
+ These favicons were generated from shopify logo maker.
@@ -0,0 +1 @@
1
+ {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
Binary file
Binary file
Binary file
@@ -0,0 +1,81 @@
1
+ # API Reference
2
+
3
+ ## Application
4
+
5
+ ### App Module
6
+
7
+ ::: imagebaker.window.app
8
+
9
+ ## Tabs
10
+
11
+ ### Layerify Tab
12
+
13
+ ::: imagebaker.tabs.layerify_tab.LayerifyTab
14
+
15
+ ### Baker Tab
16
+
17
+ ::: imagebaker.tabs.baker_tab.BakerTab
18
+
19
+ ## List Views
20
+
21
+ ### Image List Panel
22
+
23
+ ::: imagebaker.list_views.image_list.ImageListPanel
24
+
25
+ ### Annotation List
26
+
27
+ ::: imagebaker.list_views.annotation_list.AnnotationList
28
+
29
+ ### Canvas List
30
+
31
+ ::: imagebaker.list_views.canvas_list.CanvasList
32
+
33
+ ### Layer List
34
+
35
+ ::: imagebaker.list_views.layer_list.LayerList
36
+
37
+ ### Layer Settings
38
+
39
+ ::: imagebaker.list_views.layer_settings.LayerSettings
40
+
41
+ ## Layers
42
+
43
+ ### Base Layer
44
+
45
+ ::: imagebaker.layers.base_layer.BaseLayer
46
+
47
+ ### Canvas Layer
48
+
49
+ ::: imagebaker.layers.canvas_layer.CanvasLayer
50
+
51
+ ### Annotable Layer
52
+
53
+ ::: imagebaker.layers.annotable_layer.AnnotableLayer
54
+
55
+ ## Workers
56
+
57
+ ### Baker Worker
58
+
59
+ ::: imagebaker.workers.baker_worker.BakerWorker
60
+
61
+ ### Layerify Worker
62
+
63
+ ::: imagebaker.workers.layerify_worker.LayerifyWorker
64
+
65
+ ### Model Prediction Worker
66
+
67
+ ::: imagebaker.workers.model_worker.ModelPredictionWorker
68
+
69
+ ## Utilities
70
+
71
+ ### Image Utilities
72
+
73
+ ::: imagebaker.utils.image
74
+
75
+ ### State Utilities
76
+
77
+ ::: imagebaker.utils.state_utils
78
+
79
+ ### Transform Mask Utilities
80
+
81
+ ::: imagebaker.utils.transform_mask
@@ -0,0 +1,87 @@
1
+ # Image-Baker
2
+
3
+ Let's bake an image.
4
+
5
+ ## Why is it relevant?
6
+
7
+ When training computer vision models (especially for detection and segmentation), labeling large amounts of data is crucial for better model performance. Often, the process involves multiple cycles of labeling, training, and evaluation. By generating multiple realistic labeled datasets from a single image, the time spent on labeling can be significantly reduced.
8
+
9
+ ## What's up with the name?
10
+
11
+ The concept involves extracting portions of an image (e.g., objects of interest) using tools like polygons or models such as Segment Anything. These extractions are treated as layers, which can then be copied, pasted, and manipulated to create multiple instances of the desired object. By combining these layers step by step, a new labeled image with annotations in JSON format is created. The term "Baking" refers to the process of merging these layers into a single cohesive image.
12
+
13
+ ## Getting Started
14
+
15
+ ### Installation
16
+
17
+ #### Using PIP
18
+ This project is also available in PyPI server.
19
+
20
+ ```bash
21
+ pip install imagebaker
22
+ ```
23
+
24
+ #### Developing
25
+ Please, clone this repository and install it locally:
26
+
27
+ ```bash
28
+ git clone https://github.com/q-viper/image-baker.git
29
+ cd image-baker
30
+ pip install -e .
31
+ ```
32
+
33
+ ### First Run
34
+
35
+ Run the following command to launch the GUI:
36
+
37
+ ```bash
38
+ imagebaker
39
+ ```
40
+
41
+ If the command does not work, try running the example script after cloning the project.:
42
+
43
+ ```bash
44
+ python examples/app.py
45
+ ```
46
+
47
+ ## Features
48
+
49
+ - **Annotating Images**: Load a folder of images and annotate them using bounding boxes or polygons.
50
+ - **Model Testing**: Define models for detection, segmentation, and prompts (e.g., points or rectangles) by following the base model structure in [imagebaker/models/base_model.py](imagebaker/models/base_model.py). See [examples/loaded_models.py](examples/loaded_models.py) for a working example.
51
+ - **Layerifying**: Crop images based on annotations to create reusable layers. Each cropped image represents a single layer.
52
+ - **Baking States**: Arrange layers to create image variations by dragging, rotating, adjusting opacity, and more. Save the state using the **Save State** button or **Ctrl + S**.
53
+ - **Playing States**: Replay saved states, export them locally, or use them for further predictions.
54
+ - **Exporting States**: Export the final annotated JSON and the baked multilayer image.
55
+
56
+ ### Shortcuts
57
+ * **Ctrl + C**: Copy selected annotation/layer.
58
+ * **Ctrl + V**: Paste copied annotation/layer in its parent image/layer if it is currently open.
59
+ * **Delete**: Delete selected annotation/layer.
60
+ * **Left Click**: Select an annotation/layer on mouse position.
61
+ * **Left Click + Drag**: Drag a selected annotation/layer.
62
+ * **Double Left Click**: When using Polygon annotation, completes the polygon.
63
+ * **Right Click**: Deselect an annotation/layer. While on annotating polygon, undo last point.
64
+ * **Ctrl + Mouse Wheel**: Zoom In/Out on the mouse position i.e. resizes the viewport.
65
+ * **Ctrl + Drag**: If done on the background, the viewport is panned.
66
+ * **Ctrl + S**: Save State on Baker Tab.
67
+ * **Ctrl + D**: Draw Mode on Baker Tab. Drawing can happen on a selected or main layer.
68
+ * **Ctrl + E**: Erase Mode on Baker Tab.
69
+ * **Wheel**: Change size of the drawing pointer.
70
+
71
+
72
+ ## Demo
73
+
74
+ ## Demo
75
+
76
+ To see the tool in action, check out the demo video below:
77
+
78
+ [![Demo Video](https://img.youtube.com/vi/WckMT0r-2Lc/0.jpg)](https://youtu.be/WckMT0r-2Lc)
79
+
80
+ Click on the image above to play the video on YouTube.
81
+
82
+
83
+ ## Contributions
84
+
85
+ Contributions are welcome!
86
+
87
+ Do you find this project to be useful and looking for some features that is not implemented yet? Feel free to open issues or submit pull requests to improve the project.
@@ -0,0 +1,10 @@
1
+ from imagebaker.window.app import main
2
+ from imagebaker.core.configs import LayerConfig, CanvasConfig
3
+ from loaded_models import LOADED_MODELS
4
+
5
+ if __name__ == "__main__":
6
+ main(
7
+ layer_config=LayerConfig(),
8
+ canvas_config=CanvasConfig(),
9
+ LOADED_MODELS=LOADED_MODELS,
10
+ )
@@ -0,0 +1,9 @@
1
+ from imagebaker.core.configs import LayerConfig, CanvasConfig
2
+
3
+
4
+ class CustomLayerConfig(LayerConfig):
5
+ project_name: str = "Custom Project"
6
+
7
+
8
+ class CustomCanvasConfig(CanvasConfig):
9
+ project_name: str = "Custom Project"
@@ -0,0 +1,59 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ # Add the project root to sys.path
5
+ sys.path.append(str(Path(__file__).resolve().parent.parent))
6
+
7
+ from imagebaker.models.base_model import (
8
+ DefaultModelConfig,
9
+ BaseClassificationModel,
10
+ get_dummy_prediction_result,
11
+ ModelType,
12
+ )
13
+ from imagebaker.models.base_model import BaseDetectionModel
14
+ from imagebaker import logger
15
+
16
+ # Import models from the examples folder
17
+ # from examples.rtdetr_v2 import RTDetrModelConfig, RTDetrDetectionModel
18
+ # from examples.segmentation import (
19
+ # YoloSegmentationModel,
20
+ # YoloSegmentationModelConfig,
21
+ # )
22
+ # from examples.sam_model import SegmentAnythingModel, SAMModelConfig
23
+
24
+
25
+ class ClassificationModel(BaseClassificationModel):
26
+ def __init__(self, config: DefaultModelConfig):
27
+ super().__init__(config)
28
+
29
+ def predict_class(self, image):
30
+ return [get_dummy_prediction_result(self.config.model_type)]
31
+
32
+
33
+ class DetectionModel(BaseDetectionModel):
34
+ def __init__(self, config: DefaultModelConfig):
35
+ super().__init__(config)
36
+
37
+ def predict_boxes(self, image):
38
+ return [get_dummy_prediction_result(self.config.model_type)]
39
+
40
+
41
+ # detector = RTDetrDetectionModel(RTDetrModelConfig())
42
+
43
+ # classification = ClassificationModel(
44
+ # DefaultModelConfig(model_type=ModelType.CLASSIFICATION)
45
+ # )
46
+ # segmentation = YoloSegmentationModel(YoloSegmentationModelConfig())
47
+ # prompt = SegmentAnythingModel(SAMModelConfig())
48
+ dummy_detector = DetectionModel(DefaultModelConfig(model_type=ModelType.DETECTION))
49
+
50
+
51
+ LOADED_MODELS = {
52
+ "DummyDetectionModel": dummy_detector,
53
+ # "PromptModel": prompt,
54
+ # "SegmentationModel": segmentation,
55
+ # "RTDetrV2": detector,
56
+ # "ClassificationModel": classification,
57
+ }
58
+
59
+ logger.info(f"Loaded models: {LOADED_MODELS}")