Skip to content

Detecting and counting light vehicles (motorbikes and alikes) on highways, using video processing.

License

Notifications You must be signed in to change notification settings

mathieucaroff/metravision

Repository files navigation

Metravision

Detecting and counting light vehicles (motorbikes and alikes) on highways, using video processing.

Installing and launching

Basic use

The project depends on Anaconda packages. To retrieve them, you should install Miniconda or Anaconda, then install them, using:

conda install -c conda-forge opencv pyyaml ipython openpyxl

If you are on Windows, these commands should be copied to the "Anaconda Prompt" window.

You will also need to copy the last version of the configuration file, from sample/metravision.config.yml.d/v*/metravision.config.*.yml to the projet root and rename it metravision.config.yml. You may want to check that the defaults are correct for your system.

To launch the program, go to the project root and call src/main.py using Conda's the python. Passe the video files or directories you want to process as argument to the script. If you didn't change the configuration file, the results will be written to a .xlsx file inside a directory named mv-results.

The file launch-metravision.py is a helper script which finds your Conda installation, looking at usual installation places. If you are on Windows, you may want to package it into a .exe file, using PyInstaller, like we did when delivering. If so, refer to the PyInstaller section below.

Developement environnement

This project uses Pylint to perform basic quality checking on the code. Rope was used to perform refactoring tasks.

If you want to develop the project, you may want to install the python packages pylint and rope. You can do so with the command:

conda install pylint rope

PyInstaller

We packed the metravision launcher using pyInstaller. PyInstaller can be installed using pip:

conda install pip
pip install pyinstaller

"Compiling" (packing) the Metravision launcher using PyInstaller

Once pyInstaller is installed, launch-metravision.py can be packed by running the below command from the folder which contains launch-metravision.py.

pyinstaller --onefile launch-metravision.py

The target .exe will be placed into a directory named dist. It's been made to be used from either inside the repository, or one directory up, provided the repository is named metravision. All the other files generated by pyInstaller can be removed. If I'm correct, thoses files are: dist/, build/* __pycache__/*, launch-metravision.spec

This can be done in a single command from Anaconda:

pyinstaller --onefile launch-metravision.py && move /y dist\\launch-metravision.exe .. && rmdir /q dist && rmdir /s /q build && del /q launch-metravision.spec

Contributing

This project follows PEP8 style guide and PEP257 docstring conventions.

Using git

Below is the subset of the most basic git commands you need to know to work on a git project.

To get a more robust presentation of git basics, you might want to read the page Learn git in Y minutes. The below command presentations are copy-pasted from that page. Though shorter, this page will likely be harder to understand than the above linked page.

Command recap

Git data transport commands

Source: q/2745076

Command details

config

To configure settings. Whether it be for the repository, the system itself, or global configurations ( global config file is ~/.gitconfig ).

# Print & Set Some Basic Config Variables (Global)
$ git config --global user.email "MyEmail@Zoho.com"
$ git config --global user.name "My Name"

Learn More About git config.

help

To give you quick access to an extremely detailed guide of each command. Or to just give you a quick reminder of some semantics.

# Quickly check available commands
$ git help

# Check all available commands
$ git help -a

# Command specific help - user manual
# git help <command_here>
$ git help add
$ git help commit
$ git help init
# or git <command_here> --help
$ git add --help
$ git commit --help
$ git init --help

clone

Clones, or copies, an existing repository into a new directory. It also adds remote-tracking branches for each branch in the cloned repo, which allows you to push to a remote branch.

# Clone learnxinyminutes-docs
$ git clone https://github.com/adambard/learnxinyminutes-docs.git

# shallow clone - faster cloning that pulls only latest snapshot
$ git clone --depth 1 https://github.com/adambard/learnxinyminutes-docs.git

# clone only a specific branch
$ git clone -b master-cn https://github.com/adambard/learnxinyminutes-docs.git --single-branch

status

To show differences between the index file (basically your working copy/repo) and the current HEAD commit.

# Will display the branch, untracked files, changes and other differences
$ git status

# To learn other "tid bits" about git status
$ git help status

add

To add files to the staging area/index. If you do not git add new files to the staging area/index, they will not be included in commits!

# add a file in your current working directory
$ git add HelloWorld.java

# add a file in a nested dir
$ git add /path/to/file/HelloWorld.c

# Regular Expression support!
$ git add ./*.java

# You can also add everything in your working directory to the staging area.
$ git add -A

This only adds a file to the staging area/index, it doesn't commit it to the working directory/repo.

commit

Stores the current contents of the index in a new "commit." This commit contains the changes made and a message created by the user.

# commit with a message
$ git commit -m "Added multiplyNumbers() function to HelloWorld.c"

# signed commit with a message (user.signingkey must have been set
# with your GPG key e.g. git config --global user.signingkey 5173AAD5)
$ git commit -S -m "signed commit message"

# automatically stage modified or deleted files, except new files, and then commit
$ git commit -a -m "Modified foo.php and removed bar.php"

# change last commit (this deletes previous commit with a fresh commit)
$ git commit --amend -m "Correct message"

log

Display commits to the repository.

# Show all commits
$ git log

# Show only commit message & ref
$ git log --oneline

# Show merge commits only
$ git log --merges

# Show all commits represented by an ASCII graph
$ git log --graph

pull

Pulls from a repository and merges it with another branch.

# Update your local repo, by merging in new changes
# from the remote "origin" and "master" branch.
# git pull <remote> <branch>
$ git pull origin master

# By default, git pull will update your current branch
# by merging in new changes from its remote-tracking branch
$ git pull

# Merge in changes from remote branch and rebase
# branch commits onto your local repo, like: "git fetch <remote> <branch>, git
# rebase <remote>/<branch>"
$ git pull origin master --rebase

push

Push and merge changes from a branch to a remote & branch.

# Push and merge changes from a local repo to a
# remote named "origin" and "master" branch.
# git push <remote> <branch>
$ git push origin master

# By default, git push will push and merge changes from
# the current branch to its remote-tracking branch
$ git push

# To link up current local branch with a remote branch, add -u flag:
$ git push -u origin master
# Now, anytime you want to push from that same local branch, use shortcut:
$ git push

About

Detecting and counting light vehicles (motorbikes and alikes) on highways, using video processing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages