Installation

Using a virtualenv

Given the number of dependencies of camfi, it is recommended to install it in a virtualenv or conda environment (e.g. miniconda). Please see the previous links if you need help setting one of these up.

Installation using pip

Installation is as easy as:

$ pip install camfi

Once you have installed camfi, you can run it from the command line:

$ camfi <command> <flags>

Requirements

Camfi requires python 3.9 or greater.

A copy of VGG Image Annotator (VIA) Version 2 is also required in order to do manual annotation of images, and to set up VIA projects for automatic annotation by Camfi.

The GEOS library is also required by Shapely, which is one of Camfi’s dependencies. This can be installed with conda if you don’t have a system install:

$ conda install -c conda-forge geos

Concrete python library dependencies for camfi are provided in requirements.txt. They are:

bces==1.0.3
exif==1.3.1
imageio==2.9.0
matplotlib==3.4.2
numpy==1.21.1
pandas==1.3.0
Pillow==8.3.1
pydantic==1.8.2
pytz==2021.1
scikit-image==0.18.2
scikit-learn==0.24.2
scipy==1.7.0
Shapely==1.7.1
skyfield==1.39
statsmodels==0.12.2
strictyaml==1.4.4
torch==1.9.0
torchvision==0.10.0
tqdm==4.61.2
types-pytz==2021.1.0
typing-extensions==3.10.0.0

Note: Installing using $ pip install camfi will will not necessarily install the exact versions of the dependencies specified above. If you are running into unusual errors, try installing the concrete dependencies of the version of Camfi you are using. For example, you can simply cloning the repository, and install from the requirements file:

$ git clone https://github.com/J-Wall/camfi.git
$ cd camfi
$ git checkout <version>  # set to whatever version you are using
$ pip install -r requirements.txt

Development

If you want to develop Camfi, you may want to install the testing and documentation building requirements:

$ git clone https://github.com/J-Wall/camfi.git
$ cd camfi
$ pip install -r requirements.txt
$ pip install -r docs/requirements.txt  # For documentation building
$ pip install pip install pytest-cov pytest-mypy  # For testing
$ pip install -e .  # Installs camfi in develop mode

If you are making any changes to camfi.datamodel.via_region_attributes.ViaRegionAttributes, then you should run the script camfi/datamodel/_region_filter_config_dynamic.py to rebuild camfi/datamodel/region_filter_config.py before each commit:

$ python camfi/datamodel/_region_filter_config_dynamic.py
$ git add camfi/datamodel/region_filter_config.py

This script has an additional dependency, which can be installed with pip:

$ pip install datamodel-code-generator