Metadata-Version: 2.1
Name: quadrantrecon
Version: 1.0.2
Summary: Image recognition software to crop photos of marine ecosystems. Made for the MBOM Pole to Pole project.
Author-Email: Lino Bigatti <linobigatti@protonmail.com>
License: MIT
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Environment :: GPU :: NVIDIA CUDA :: 12
Classifier: Framework :: Matplotlib
Classifier: Natural Language :: English
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.12
Requires-Dist: torch>=2.3.0
Requires-Dist: torchvision>=0.18.0
Requires-Dist: attrs>=23.2.0
Requires-Dist: autocommand>=2.2.2
Requires-Dist: cffi>=1.16.0
Requires-Dist: charset-normalizer>=3.3.2
Requires-Dist: contourpy>=1.2.1
Requires-Dist: cryptography>=42.0.5
Requires-Dist: cycler>=0.12.1
Requires-Dist: fastjsonschema>=2.19.1
Requires-Dist: filelock>=3.14.0
Requires-Dist: fonttools>=4.51.0
Requires-Dist: fsspec>=2024.3.1
Requires-Dist: future>=1.0.0
Requires-Dist: gmpy2>=2.2.0a1
Requires-Dist: idna>=3.6
Requires-Dist: inflect>=7.2.1
Requires-Dist: jaraco-context>=4.3.0
Requires-Dist: jaraco-functools>=4.0.0
Requires-Dist: jaraco-text>=3.12.0
Requires-Dist: Jinja2>=3.1.3
Requires-Dist: kiwisolver>=1.4.5
Requires-Dist: MarkupSafe>=2.1.5
Requires-Dist: matplotlib>=3.8.4
Requires-Dist: more-itertools>=10.2.0
Requires-Dist: mpmath>=1.3.0
Requires-Dist: networkx>=3.3
Requires-Dist: numpy==1.26.4
Requires-Dist: opencv-python>=4.9.0.80
Requires-Dist: ordered-set>=4.1.0
Requires-Dist: packaging>=24.0
Requires-Dist: pandas>=1.5.3
Requires-Dist: pillow>=10.3.0
Requires-Dist: platformdirs>=4.2.0
Requires-Dist: pooch>=1.8.1
Requires-Dist: pybind11>=2.12.0
Requires-Dist: pycparser>=2.22
Requires-Dist: pyparsing>=3.1.2
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: pytz>=2024.1
Requires-Dist: PyYAML>=6.0.1
Requires-Dist: requests>=2.31.0
Requires-Dist: scipy>=1.13.0
Requires-Dist: setuptools>=69.0.3
Requires-Dist: six>=1.16.0
Requires-Dist: smbus>=1.1
Requires-Dist: sympy>=1.12
Requires-Dist: TBB>=0.2
Requires-Dist: tomli>=2.0.1
Requires-Dist: trove-classifiers>=2024.4.10
Requires-Dist: typeguard>=4.2.1
Requires-Dist: typing-extensions>=4.11.0
Requires-Dist: urllib3>=1.26.18
Requires-Dist: validate-pyproject>=0.16
Requires-Dist: wheel>=0.43.0
Requires-Dist: tk>=0.1.0
Requires-Dist: piexif>=1.1.2
Requires-Dist: tqdm>=4.67.1
Requires-Dist: segment-anything-py>=1.0.1
Requires-Dist: iptcinfo3>=2.1.4
Description-Content-Type: text/markdown

# QuadrantRecon
QuadrantRecon is an image recognition tool designed to crop quadrants from photos of marine ecosystems, as a preprocessing step for [CoralNET]().
As configured by default, this tool will recognize yellow quadrants from the [MBOM Pole to Pole Project]() on any file you select and crop their inside area.
The detection parameters can be configured to detect other colors, crop differently sized images, or even ignore different parts of the image to detect other quadrant-like shapes.

## Installation

You can install QuadrantRecon via pip:

```bash
# Linux
pip install quadrantrecon

# Windows
py -m pip install quadrantrecon
```

Afterwards, we need to download the model weights. You can find the default one [here](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth).
You can change the file name to `sam_vit_h.pth` and place it in the folder where the program is executed to load it automatically, or you can provide your own file with the `--model-path` and `--model-type` flags:

```bash
# Linux
python -m quadrantrecon --model-path sam_vit_h_4b8939.pth --model-type vit_h

# Windows
py -m quadrantrecon --model-path sam_vit_h_4b8939.pth --model-type vit_h
```

## Usage
The program can be invoked by using the [-m flag](https://docs.python.org/3/using/cmdline.html#cmdoption-m) as follows. You can use the --help command to see possible options.

```bash
# Linux
python -m quadrantrecon --help

# Windows
py -m quadrantrecon --help
```

You can run the program in batch mode by using more than 1 filename or specifying an input folder.

## Development setup

### Prerequisites
- [Python 3.12 (64 bits)](https://www.python.org/downloads/release/python-3120/)
- [Git](https://git-scm.com/downloads)
- [CUDA Toolkit 12.8](https://developer.nvidia.com/cuda-downloads) (If you want GPU acceleration)

### Installing dependencies
First, we need to install the required submodules. We can do this using git:
```bash
git submodule update --init --recursive
```
If you are using another git client, look up how to initialize submodules with it.

Afterwards, we need to download the model weights. You can find the default one [here](https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth).
Change the file name to sam_vit_h.pth and place it in this folder.

Then, we need to install the python dependencies. A virtual env is recommended, but particularly on windows, it might not work correctly, so feel free to skip this step.
You can create one to install the program like this:
```bash
# Linux
python3.12 -m venv venv/
source venv/bin/activate

# Windows
py -m venv venv/
source venv/Scripts/Activate.ps1
```

To finish up, we need to install the python dependencies and the package itself. Make sure to choose the correct command for your setup.
```bash
# Linux (no CUDA support)
pip install . --index-url https://download.pytorch.org/whl/cpu

# Linux (with CUDA support)
pip install .

# Windows (no CUDA support)
py -m pip install .

# Windows (with CUDA support)
py -m pip install . --index-url https://download.pytorch.org/whl/cu121
```
