Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hereariim committed Nov 4, 2023
1 parent 1521990 commit f1d04b3
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 8 deletions.
130 changes: 124 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ An user-friendly plugin that enables to annotate images from pre-trained model (

----------------------------------

The Manini plugin for napari a tool to perform image inference from a pre-trained model (tensorflow .h5) and then annotate the resulting images with the tools provided by napari. Its development is ongoing.

![Screencast from 24-01-2023 14 00 51](https://user-images.githubusercontent.com/93375163/214298805-8405a923-5952-458c-8542-7c78887479ab.gif)

----------------------------------

This [napari] plugin was generated with [Cookiecutter] using [@napari]'s [cookiecutter-napari-plugin] template.

<!--
Don't miss the full getting started guide to set up your new package:
https://github.com/napari/cookiecutter-napari-plugin#getting-started
and review the napari docs for plugin developers:
https://napari.org/stable/plugins/index.html
https://napari.org/stable/plugins/index.html!
-->

## Installation
Expand All @@ -27,17 +34,128 @@ You can install `manini` via [pip]:

pip install manini



To install latest development version :

pip install git+https://github.com/hereariim/manini.git


## Contributing
## Description

This plugin is a tool to perform 2D image inference. The inference is open to the model for image segmentation (binary or multiclass), image classification and object detection.
This tool is compatible with tensorflow h5 models. In this format, the h5 file must contain all the elements of the model (architecture, weights, etc).

### Image segmentation

This tool allows image inference from a segmentation model.

#### Input

The user must deposit two items (+1 optional item).

- A compressed file (.zip) containing the images in RGB

```
.
└── input.zip
├── im_1.JPG
├── im_2.JPG
├── im_3.JPG
...
└── im_n.JPG
```

- A tensorflow h5 file (.h5) which is the segmentation model
- A text file (.txt) containing the names of the classes (optional)

The Ok button is used to validate the imported elements. The Run button is used to launch the segmentation.

#### Processing

Once the image inference is complete, the plugin returns a drop-down menu showing a list of RGB images contained in the compressed file. When the user clicks on an image displayed in this list, two items appear in the napari window:

- A layer label which is the segmentation mask
- A layer image which is the RGB image

![cpe](https://user-images.githubusercontent.com/93375163/214246685-e86a9f62-bb27-44b5-92eb-86ef5aa2c663.png)

A widget also appears to the right of the window. This is a list of the classes in the model with their associated colours. In this tool, the number of classes is limited to 255.

The user can make annotations on the layer label. For example, the user can correct mispredicted pixels by annotating them with a brush or an eraser.

#### Output

The Save button allows you to obtain a compressed image file. This file contains folders containing the RGB images and their greyscale mask.

### Image classification

This tool performs image inference from an image classification model.

#### Input

This tool offers three mandatory inputs:

- A compressed file (.zip) containing the RGB images

```
.
└── input.zip
├── im_1.JPG
├── im_2.JPG
├── im_3.JPG
...
└── im_n.JPG
```

- A tensorflow h5 (.h5) file which is the image classification model
- A text file (.txt) containing the class names

The Ok button is used to validate the imported elements. The Run button is used to launch the classification.

#### Processing

Once the image inference is complete, the plugin returns two elements :

- a drop-down menu showing a list of RGB images contained in the compressed file.
- an table containing the predicted class for each image.

![cpe2](https://user-images.githubusercontent.com/93375163/214252875-c8e59773-4c3d-4582-b8db-67c59ab01975.png)

The user can change the predicted class by selecting a class displayed in the associated drop-down menu for an image.

#### Output

The Save button allows you to obtain a csv file. This file is the table on which the user had made his modifications.

### Detection

This tool performs image inference from an yolo object detection model. The inference is made from [darknet] command

#### Input

This tool offers five mandatory inputs:

- A folder which is the darknet repository images
- A file (.data) containing the paths (train,validation,test,class) and the number of class
- A file (.cfg) containing the model architecture
- A file (.weight) containing the weights associated to the model (.cfg) cited just above
- A file (.txt) that indicates the path of the images

The Ok button is used to validate the imported elements. The Run button is used to launch the command `./darknet detector test` .

#### Processing

When the prediction of bounding box coordinates is complete for each image, the plugin returns two elements:

- A menu that presents a list of the RGB images given as input.
- A menu that presents a list of the classes given as input

![Screenshot from 2023-01-24 10-33-07](https://user-images.githubusercontent.com/93375163/214257222-945ed096-49dd-4b91-aa2a-df4c43a30372.png)

The window displays the bounding boxes and the RGB image. The bounding box coordinates are taken from the json file which is an output file of the darknet detector test command. The user can update these coordinates by deleting or adding one or more bounding boxes. From the list of classes, the user can quickly add a bounding box to the image.

#### Output

Contributions are very welcome. Tests can be run with [tox], please ensure
the coverage at least stays the same before you submit a pull request.
The Save button allows you to obtain a json file. This file contains for each image, the bounding box coordinates and the class for each detected object.

## License

Expand Down
25 changes: 23 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ install_requires =
numpy
magicgui
qtpy
napari
magicgui
scikit-image
numpy
pandas
opencv-python-headless
tensorflow
PyQt5
PIL>=8.4.0

python_requires = >=3.8
include_package_data = True
Expand All @@ -58,7 +66,20 @@ testing =
pytest-qt # https://pytest-qt.readthedocs.io/en/latest/
napari
pyqt5

pytest # https://docs.pytest.org/en/latest/contents.html
pytest-cov # https://pytest-cov.readthedocs.io/en/latest/
pytest-xvfb # sys_platform == 'linux'
numpy
magicgui
qtpy
napari
magicgui
scikit-image
numpy
pandas
opencv-python-headless
tensorflow
PyQt5

[options.package_data]
* = *.yaml
manini = napari.yaml
44 changes: 44 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from setuptools import setup, find_packages
with open("README.md","r",encoding="utf-8") as fh:
long_description = fh.read()
setup(
name = "manini",
version = "0.0.1",
description = "An user-friendly plugin that enables to annotate images from a pre-trained model (segmentation, classification, detection) given by an user.",
long_description = long_description,
long_description_content_type = "text/markdown",
url = "https://github.com/hereariim/manini",
packages=find_packages(),
author = "Herearii Metuarea",
author_email = "herearii.metuarea@gmail.com",
license = "BSD-3-Clause",
license_files = "LICENSE",
classifiers =[
"Development Status :: 2 - Pre-Alpha",
"Framework :: napari",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Image Processing",
],
install_requires = [
"numpy",
"magicgui",
"qtpy",
"napari",
"magicgui",
"scikit-image",
"numpy",
"pandas",
"opencv-python-headless",
"tensorflow",
"PyQt5"
],
python_requires = ">=3.8",
)

0 comments on commit f1d04b3

Please sign in to comment.