mycroft is an open source web application for filtering videos based on information like position, time and objects in the video. mycroft was originally developed as a proof of concept for the Swedish Police as a bachelor project in software engineering at Linköping University.
To set up the project, you will have to install Django and Django REST. To do this you will probably want to create a Python Virtual Environment.
The following tools are expected to be installed on the hosting machine.
If building on Windows, makes sure to update the PATH Environment Variable. This is usually an option in the installer.
- Python 3.8.1
- Node.js
Note: If you can not run python from the terminal and you have already added the path. Move the path for python in Environment Variable, to the top. This will prioritize this path over the ones below.
To make sure everything is installed, run:
python --version
npm -v
node -v
Run python -m venv venv
in the root-folder of the project to create a folder called venv.
Still in the root folder, to activate the virtual environment:
- run
source venv/bin/activate
on Linux - run
"venv/Scripts/activate.bat"
on Windows cmd - run
./venv/Scripts/activate.ps1
on Windows Powershell
To deactivate the virtual environment, run deactivate
.
First, activate the virtual environment, then run pip install -r requirements.txt
.
To use mycroft you will have to create a dedicated folder on your system. Once you have this folder you can create subfolders (with arbitrary file hierarchies) in which you add your videos.
NOTE: There shall be no videos in the root folder.
Along with every video you must add a metadata file (in the same folder) with information about the position, start time and camera name for the video.
The metadata file should have the same name as the video file along with an extra .txt suffix so for example if the video is named my_video.mp4 the metadata file should be named my_video.mp4.txt.
The metadata file should include three parenthesises with the information where the first one is the position (in decimal degrees), the second is the start time and the third is the camera name. The following is an example of how a correct metadata file can look.
(58.4106611, 15.6198244)
(2020-05-25 15:45:59)
(my awesome camera)
Other than that the parentheses appear in the right order and no other parentheses appear in the file the metadata can be structured in an arbitrary way.
In the purpose of testing mycroft a script genfakemetadata.py has been provided. The script takes a folder with videos and creates fake metadata files which can be used for testing mycroft. See mycroft wiki for more information.
First of all, make sure your virtual environment is activated and that you are in the root folder of mycroft.
In order to create the database run python manage.py migrate
. If this was succesful you should se a new file in the root folder called db.sqlite3. This is the database.
To be able to use the videos you have prepared you will have to add your root folder with videos as an entry folder.
- run
source setentryfolder <path to folder>
on Linux - run
./setentryfolder.bat <path to folder>
on Windows Powershell
If this worked correctly you will se a message "Successfully added entry folder." As long as you do not modify the file system you only have to run this command once.
To start mycroft:
- run
source run
on Linux - run
./run.bat
on Windows Powershell
If this worked correctly you should see something like "Starting development server at http://127.0.0.1:8000/" in your console. Open the specified address in a web browser (preferably Google Chrome). Congratulation, you are now ready to start using mycroft.
If you want to contribute to mycroft or contact the developers simply interact with us via our GitHub profiles, open issues or create pull requests. See mycroft wiki for technical details about contributing.
We are happy to help!