Motion tracking engine for the project UTC ACD, using computer vision to control plane engines. It is used by the ACD client as a server to validate images.
These instructions will get you a copy of the project up and running on your local machine for testing purposes only.
The project runs with Python 3.6+ (tested on 3.12) and Python libraries packaged using Anaconda. Any desktop operating system supported by Anaconda should work.
A regular installation of Python and the project's dependencies would work, but it is preferable to use Anaconda to create a separate virtual environment with the good version of the libraries. This can prevent this installation to interfere with possible others.
First, install Anaconda following the instructions from its website. Once installed, open Anaconda prompt on Windows and on Unix systems, open a terminal.
Create the virtual envionment mte-env
for the project:
conda create -n mte-env python=3.12
you can add the minor version number to install this specific version of Python.
Then, activate the environment:
conda activate mte-env
Finally, install the dependencies inside the virtual environment:
python -m pip install -r requirements.txt
Install the dependencies for D2Net inside the virtual environment:
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
conda install h5py imageio imagesize matplotlib numpy scipy tqdm
The activating step should be executed each time you wish to run the project:
conda activate mte-env
You should see (mte-env)
at the beginning of the current shell line.
Navigate to the folder where the programs are and run the server:
python MTE.py
You can see how to parametrate the server by launching instead:
python MTE.py --help
Run the client in another terminal with the Anaconda environment (mte-env)
activated:
python Client.py
The server is by default in prelearning mode. Press the 2 key with the Debug
window activated to learn the current image of the video stream.
The learning mode is printed in the server command window and then the server goes back to prelearning mode.
You can then press the 3 key on the Debug
window to launch the recognition mode. The Transformed
window should appear. When the recognition works, the image is warped to match the learning image and printed in the Transformed
window. When it fails, the resized image of the video stream is showed. The state of the recognition is also printed in the client command window.
To quit the programs, first press the Q key on the Debug
window and then press CTRL+C on the server command window.
Note: If you want to deactivate the environment to go back to your regular shell, just type:
conda deactivate
To use the MTE in its Docker environment, first install Docker following the instructions on its website.
Be sure to be at the root of the project and build the image :
docker build .
The output should print the image ID at the end of the build, something like Successfully built <imageID>
.
You can run the Motion tracking server by entering the following command and replacing imageID
by the actual image ID you had at the installation:
docker run -p 5555:5555 <imageID>
If you lost the image ID, you can find it running:
docker image list
To build the application, you can use the following command on windows:
.\build.ps1
this will install the dependencies for the application and the build then build the application.
The application will be built in the build
folder and the executable should be named MTE or MTE.exe.
IMPORTANT: The script will need to be updated when cx-freeze will be available for Python 3.12.
Check if cx-freeze is available for Python 3.12 and add it to the build-requirements.txt
file if it is.
You can check the availability of cx-freeze for Python 3.12 on the pypi website and on their github.
Then, remove the following lines from the build.ps1
script as they will not be needed anymore:
echo "Installing cx_Freeze Beta version as version for python 3.12 is not available at the time of writing this script."
pip install --force --quiet --no-cache --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze