The imageprocessing package contains four Simian web apps for modifying and generating images and supporting modules. All apps allow for downloading the created figure. When an input image is used, this can be uploaded.
-
processor.image_processor- Upload an image, select and parametrize
Pillowimage modification actions, and download the processed image.
- Upload an image, select and parametrize
-
inpainter.image_inpainter- Allows for drawing a white mask on the image where the image can be modified. The drawn mask is made available to the processing action as a separate image.
-
generator.image_generator- No input image is used, as the base image is generated based on action settings.
- The name of the output file must be specified.
-
pytorch.image_transform- Upload an image, select the combination method, select and parameterize
PyTorchvision transforms, and download the processed image.
- Upload an image, select the combination method, select and parameterize
-
annotator.image_annotator- Upload images and an optional label definitions file, draw shapes on the figures and select from the predefined labels. When all figures are annotated you can download a .csv file with the annotations. The app can be extended with an AI object
detection_model.pymodule that runs an object detection algorithm on inputs given by the app and returns the result in the format expected by the app.
- Upload images and an optional label definitions file, draw shapes on the figures and select from the predefined labels. When all figures are annotated you can download a .csv file with the annotations. The app can be extended with an AI object
simian.guiInstallation manualsimian.localWhen running locally.- requirements.txt Dependencies for all apps
- requirements-imagegen.txt Dependencies for the image generator app.
- pytorch/requirements.txt PyTorch Transform dependencies.
- annotator/requirements.txt Optional AI image detection dependencies, incl. Detectron2.
-
parts.actions_list.py- Defines as list of Python Pillow modifications
- Available in all apps as (post)processing actions.
-
inpainter.inpaint_actions.py- Defines a list of actions where an area of an image is selected for processing.
-
generator.image_gen_actions.py- Defines as list of actions where an image is generated based on the given settings.
- Create a subclass of the
imageprocessing.parts.actions_list.ImageActionclass. - Set the
labelattribute that is shown in the actions dropdown list. - (Optionally) set the
summaryattribute. - Set the
nr_image_inputsattribute to:- 0 for image generation
- 1 for modifying an image. The default.
- 2 for inpainting an image in a masked region.
- Fill the
parameterattribute with a list of dicts:- The keys of the dict must match the
simian.gui.composed_component.PropertyEditorrow properties. - extra keys are ignored.
- The keys of the dict must match the
- Implement the
perform_actionmethod with inputs:image_file: is the full input image name in the session folder.target_file: name of the image file that must be saved to in the action. In theimage_inpainterapp thetarget_filecontains the drawn mask image.*args: A list of values selected in the Parameter list.
The modify action's parameters' definitions may contain the following keys:
| Key | Example | Extra |
|---|---|---|
| datatype | "numeric" | Mandatory |
| label | "Property name" | Mandatory |
| tooltip | "Tooltip text" | |
| required | False | |
| defaultValue | "Default value" | Defaults to a minLength long list of Nones. |
| min | 0 | Numeric |
| max | 2 | Numeric |
| decimalLimit | 2 | Numeric |
| allowed | ["A", "B", "C"] | Select component data source values definition. |
| minLength | 1 | {1} Scalar, or minimum array length of 0 or more. |
| maxLength | 1 | {1} Scalar, or maximum array length of 0 or more. |
The supported data types are: "boolean", "numeric", "select", and "text".
The following example defines a numeric parameter, allowing a two decimal value between zero and one to be selected.
{
"label": "Strength",
"datatype": "numeric",
"defaultValue": 0.9,
"min": 0,
"max": 1,
"numberOfDecimals": 2,
"tooltip": "The extent to transform the reference image.",
"required": True,
},