Skip to content

Commit

Permalink
Merge branch 'release/1.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
cheind committed Jul 10, 2018
2 parents 611475e + ae83b5a commit 125304f
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
- conda info -a

# Install deps
- deps='pip numpy scipy'
- deps='pip numpy scipy cython'
- conda create -q -n pyenv python=$PYTHON pandas=$PANDAS $deps
- source activate pyenv
- python -m pip install -U pip
Expand Down
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubuntu:latest

MAINTAINER Avgerinos Christos <christosavg@gmail.com>

#ARG GT_DIR
#ARG TEST_DIR

RUN apt-get update \
&& apt-get install -y python3-pip python3-dev vim \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip

RUN pip3 install --no-cache-dir numpy scipy
RUN pip install -Iv pandas==0.21.0
RUN mkdir -p /motmetrics/py-motmetrics
RUN mkdir -p /motmetrics/2DMOT2015

COPY ./py-motmetrics /motmetrics/py-motmetrics
COPY ./data /motmetrics/data

#RUN pip install motmetrics
RUN pip install -e ./motmetrics/py-motmetrics/

#RUN pip install -r motmetrics/py-motmetrics/requirements.txt

ENV GT_DIR motmetrics/data/train/
ENV TEST_DIR motmetrics/data/test/

#ENTRYPOINT python3 -m motmetrics.apps.eval_motchallenge motmetrics/data/train/ motmetrics/data/test/ && /bin/bash
CMD ["sh", "-c", "python3 -m motmetrics.apps.eval_motchallenge ${GT_DIR} ${TEST_DIR} && /bin/bash"]

19 changes: 19 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


[![PyPI version](https://badge.fury.io/py/motmetrics.svg)](https://badge.fury.io/py/motmetrics) [![](https://travis-ci.org/cheind/py-motmetrics.svg?branch=master)](https://travis-ci.org/cheind/py-motmetrics)

## py-motmetrics
Expand Down Expand Up @@ -425,6 +427,23 @@ EURASIP Journal on Image and Video Processing 2008.1 (2008): 1-10.
Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on. IEEE, 2009.
4. Performance Measures and a Data Set for Multi-Target, Multi-Camera Tracking. E. Ristani, F. Solera, R. S. Zou, R. Cucchiara and C. Tomasi. ECCV 2016 Workshop on Benchmarking Multi-Target Tracking.

### Docker

#### Update ground truth and test data:
/data/train directory should contain MOT 2D 2015 Ground Truth files.
/data/test directory should contain your results.

You can check usage and directory listing at
https://github.com/cheind/py-motmetrics/blob/master/motmetrics/apps/eval_motchallenge.py

#### Build Image
docker build -t desired-image-name -f Dockerfile .

#### Run Image
docker run desired-image-name

(credits to [christosavg](https://github.com/christosavg))

### License

```
Expand Down
2 changes: 1 addition & 1 deletion Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [pip install lapsolver]
- pip install .
- pytest
- deactivate motmetrics-env
- deactivate
- conda env remove -n motmetrics-env
- git add, commit
- git flow release finish <VERSION>
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ install:
- conda config --set always_yes yes
- conda update -q conda
- conda config --set auto_update_conda no
- conda install -q pip pytest numpy
- conda install -q pip pytest numpy cython
- python -m pip install -U pip
- pip install wheel
- pip install --upgrade --ignore-installed setuptools
Expand Down
2 changes: 1 addition & 1 deletion motmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@


# Needs to be last line
__version__ = '1.1.2'
__version__ = '1.1.3'
8 changes: 4 additions & 4 deletions motmetrics/mot.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ def new_event_dataframe():
df = pd.DataFrame(
OrderedDict([
('Type', pd.Series(cats)), # Type of event. One of FP (false positive), MISS, SWITCH, MATCH
('OId', pd.Series(dtype=str)), # Object ID or -1 if FP. Using float as missing values will be converted to NaN anyways.
('HId', pd.Series(dtype=str)), # Hypothesis ID or NaN if MISS. Using float as missing values will be converted to NaN anyways.
('OId', pd.Series(dtype=object)), # Object ID or -1 if FP. Using float as missing values will be converted to NaN anyways.
('HId', pd.Series(dtype=object)), # Hypothesis ID or NaN if MISS. Using float as missing values will be converted to NaN anyways.
('D', pd.Series(dtype=float)), # Distance or NaN when FP or MISS
]),
index=idx
Expand All @@ -271,8 +271,8 @@ def new_event_dataframe_with_data(indices, events):
raw_type = pd.Categorical(tevents[0], categories=['RAW', 'FP', 'MISS', 'SWITCH', 'MATCH'], ordered=False)
series = [
pd.Series(raw_type, name='Type'),
pd.Series(tevents[1], dtype=str, name='OId'),
pd.Series(tevents[2], dtype=str, name='HId'),
pd.Series(tevents[1], dtype=object, name='OId'),
pd.Series(tevents[2], dtype=object, name='HId'),
pd.Series(tevents[3], dtype=float, name='D')
]

Expand Down
11 changes: 7 additions & 4 deletions motmetrics/tests/test_mot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def test_events():
expect.loc[(4, 5), :] = ['MATCH', 2, 'b', 5.]
# frame 5 generates no events

assert pd.DataFrame.equals(acc.events, expect)
from pandas.util.testing import assert_frame_equal
assert_frame_equal(acc.events, expect)


def test_max_switch_time():
Expand Down Expand Up @@ -115,9 +116,10 @@ def test_merge_dataframes():
acc.update([1, 2], ['a', 'b'], [[1, 0.5], [0.3, 1]], frameid=2)
acc.update([1, 2], ['a', 'b'], [[0.2, np.nan], [np.nan, 0.1]], frameid=3)

r, mappings = mm.MOTAccumulator.merge_event_dataframes([acc.events, acc.events], return_mappings=True)
r, mappings = mm.MOTAccumulator.merge_event_dataframes([acc.events, acc.events], return_mappings=True)

expect = mm.MOTAccumulator.new_event_dataframe()

expect.loc[(0, 0), :] = ['RAW', np.nan, mappings[0]['hid_map']['a'], np.nan]
expect.loc[(0, 1), :] = ['RAW', np.nan, mappings[0]['hid_map']['b'], np.nan]
expect.loc[(0, 2), :] = ['FP', np.nan, mappings[0]['hid_map']['a'], np.nan]
Expand All @@ -143,7 +145,6 @@ def test_merge_dataframes():
expect.loc[(3, 5), :] = ['SWITCH', mappings[0]['oid_map'][2], mappings[0]['hid_map']['b'], 0.1]

# Merge duplication

expect.loc[(4, 0), :] = ['RAW', np.nan, mappings[1]['hid_map']['a'], np.nan]
expect.loc[(4, 1), :] = ['RAW', np.nan, mappings[1]['hid_map']['b'], np.nan]
expect.loc[(4, 2), :] = ['FP', np.nan, mappings[1]['hid_map']['a'], np.nan]
Expand All @@ -167,5 +168,7 @@ def test_merge_dataframes():
expect.loc[(7, 3), :] = ['RAW', mappings[1]['oid_map'][2], mappings[1]['hid_map']['b'], 0.1]
expect.loc[(7, 4), :] = ['SWITCH', mappings[1]['oid_map'][1], mappings[1]['hid_map']['a'], 0.2]
expect.loc[(7, 5), :] = ['SWITCH', mappings[1]['oid_map'][2], mappings[1]['hid_map']['b'], 0.1]

from pandas.util.testing import assert_frame_equal
assert_frame_equal(r, expect)

assert pd.DataFrame.equals(r, expect)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy>=1.12.1
pandas>=0.19.2
pandas>=0.23.1
scipy>=0.19.0

0 comments on commit 125304f

Please sign in to comment.