NOTE: For this you will need to have
condainstalled. If you do not have it, you can install it by following the instructions from the official documentation.
For using the provided application you will need to install the dependecies by running the following code:
conda create -n dexter python=3.10
conda activate dexter
conda install matplotlib numpy opencv scipy tqdm -y
pip install tf_kerasFor creating a Python virtual environment you can use the following guide. Then install the dependencies using pip.
This will create a new environment called dexter and install the required packages, using the Python3.
After that we will want to install the Tensorflow package with the MPS capabilities for the MacOS. This will ensure a faster processing time. For this we will use the following code:
conda install -c apple tensorflow-deps
pip install tensorflow-macos==2.15.0
pip install tensorflow-metal==1.1.0For Windows you can use the following code:
pip install tensorflowFor other platforms or distribution, please refer to offical documentation.
After the instalation is complete, you will need to create a folder in the data directory called test. Here you can put all of the images.
So the folder structure should look like this:
data
│
└───test
│ │
│ └───001.jpg
│ │ 002.jpg
│ │ ...
After that you can run the following code:
python main.pyNote: If you encounter the following error:
ImportError: attempted relative import with no known parent packageorModuleNotFoundError: No module namedmake sure to run the script from thesrcfolder and if that does not work, try to run the script with the following code:
export PYTHONPATH=$PYTHONPATH:$(pwd)This will generate the predictions for each task in the data/output directory.
On my machine the processing time for 200 images with the MPS capabilities enabled was around 13 minutes. Also keep in mind the data loaders for the CNN models are using a small batches to ensure a lower use of hardware resources.