Skip to content

Commit f8893d1

Browse files
committed
lets go!
1 parent dd3ffdf commit f8893d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3135
-13
lines changed

README.md

+61-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,72 @@
11
# CompressAI-Vision
22

3-
Extensions on top of CompressAI to support video coding for machine applications
3+
*for complete documentation, please go directly to (TODO: link)*
4+
5+
## Synopsis
6+
7+
CompressAI-Vision helps you to develop, test and evaluate [CompressAI](https://interdigitalinc.github.io/CompressAI) models with standardized tests.
8+
9+
Image and video coding models can be tested using various metrics, say SSIM and PNSR, but also againts image detection and segmentation tasks.
10+
11+
Developing optimized encoders for pipelines including deep-learning-based detectors is called "video coding for machines" (VCM) and its goal is to create efficient encoders for machine learning tasks:
12+
```
13+
Video stream --> Encoding + Decoding --> Detector
14+
```
15+
16+
A typical metric for evaluating the encoder's efficiency for serving a detection/segmentation task, is the mean average precision (mAP) as function of a set of encoding/quality parameters:
17+
18+
TODO: add a figure here
19+
20+
For testing the VCM pipeline, various mAP measures (as in COCO or OpenImageV6 evaluation protocols) and datasets can be used, while the deep-learning CompressAI-based models are typically compared againts a well-known "anchor" pipeline, featuring a classical/standard image/video codec, say, H266.
21+
22+
The **MPEG working group for VCM** has created a set of standards for testing VCM, including standardized data/image sets (typically OpenImageV6 subsets), evaluation protocols (OpenImageV6) and anchor pipelines (VTM/H266 based)
23+
24+
## Features
25+
26+
CompressAI-Vision makes the handling and evaluation of the mentioned datasets with any encoding/decoding and detection pipeline a breeze:
27+
28+
- It uses [fiftyone](https://voxel51.com/docs/fiftyone/) for dataset downloading, handling, visualization and evaluation protocols. Several evaluation protocols are supported via fiftyone
29+
30+
- Supports CompressAI, VTM/H266 (TODO: link) and custom modules for the encoding/decoding part
31+
32+
- Uses [Detectron2](https://detectron2.readthedocs.io/en/latest/index.html) for detector and image segmentation models
33+
34+
- Supports official MPEG committee input files (TODO: link to mpeg vcm document?)
35+
36+
- Single-shot CLI commands for fast input file import, image download and evaluation
37+
38+
- Docker images, including all required components (CompressAI, VTM, Detectron2, CUDA support and whatnot) are provided to get you started asap
39+
40+
Tutorials, API documentation and notebook examples are provided, so please, go to the documentation to get started (TODO: link here)
441

542
## Installation
643

7-
CompressAI-Vision supports python 3.6+ and PyTorch 1.7+.
44+
Your software stack will look like this (all with CUDA support):
845

46+
- [PyTorch](https://pytorch.org/)
47+
- [CompressAI](https://interdigitalinc.github.io/CompressAI)
48+
- [Detectron2](https://detectron2.readthedocs.io/en/latest/index.html)
49+
- [fiftyone](https://voxel51.com/docs/fiftyone/)
50+
- VTM (TODO: link)
51+
- _This_ library (CompressAI-Vision)
52+
- Jupyter notebooks
953

10-
**From source**:
54+
Instructions for creating a correct ``virtualenv`` are provided in the documentation (TODO: link).
1155

12-
A C++17 compiler, a recent version of pip (19.0+), and common python packages
13-
are also required (see `setup.py` for the full list).
56+
Docker images with the correct software stack are also provided (TODO: link).
1457

15-
To get started locally and install the development version of CompressAI, run
16-
the following commands in a [virtual environment](https://docs.python.org/3.6/library/venv.html):
58+
## Copyright
1759

18-
```bash
19-
git clone https://github.com/InterDigitalInc/compressai-vision compressai-vision
20-
cd compressai-vcm
21-
pip install -U pip && pip install -e .
22-
```
60+
InterDigital 2022
61+
62+
## License
63+
64+
TODO
65+
66+
## Authors
67+
68+
Sampsa Riikonen
69+
70+
Jacky Lam
2371

24-
to be continued
72+
Fabien

bash/cleanpy.bash

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
## most of these should be done through .gitignore
3+
## clean python bytecode
4+
find . -name "__pycache__" -exec rm -rf {} \;
5+
find . -name "*.pyc" -exec rm -rf {} \;
6+
## python autodoc clean:
7+
find . -name "*.pickle" -exec rm -rf {} \;
8+
## clean python build
9+
rm -rf dist
10+
rm -rf build
11+
# rm -rf *.egg-info
12+
rm -f *.deb

compressai_vision/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

compressai_vision/cli/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from compressai_vision.cli.download import main as download
2+
from compressai_vision.cli.list import main as list
3+
from compressai_vision.cli.deregister import main as deregister
4+
from compressai_vision.cli.register import main as register
5+
from compressai_vision.cli.nokia_convert import main as nokia_convert
6+
from compressai_vision.cli.detectron2_eval import main as detectron2_eval
7+
from compressai_vision.cli.load_eval import main as load_eval

compressai_vision/cli/auto.py

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
"""cli.py : Command-line interface tools for compressai-vision
2+
3+
* Copyright: 2022 InterDigital
4+
* Authors : Sampsa Riikonen
5+
* Date : 2022
6+
* Version : 0.1
7+
8+
This file is part of compressai-vision libraru
9+
"""
10+
import os, sys
11+
12+
# define legit filenames.. there are inconsistencies here
13+
fname_list=["detection_validation_input_5k.lst",
14+
"detection_validation_5k_bbox.csv", # inconsistent name
15+
"detection_validation_labels_5k.csv",
16+
"segmentation_validation_input_5k.lst",
17+
"segmentation_validation_bbox_5k.csv",
18+
"segmentation_validation_labels_5k.csv",
19+
"segmentation_validation_masks_5k.csv"]
20+
21+
help_st="""
22+
compressai-nokia-auto-import
23+
24+
Automatic downloading of images and importing nokia-provided files into fiftyone
25+
26+
Before running this command (without any arguments), put the following files into the same directory
27+
(please note 'detection_validation_5k_bbox.csv' name inconsistency):
28+
29+
"""
30+
for fname in fname_list:
31+
help_st += fname + "\n"
32+
help_st += "\n"
33+
34+
class Namespace:
35+
pass
36+
37+
def get_(key):
38+
"""So that we use only legit names
39+
"""
40+
return fname_list[fname_list.index(key)]
41+
42+
def main():
43+
from compressai_vision.cli import download, nokia_convert, register
44+
45+
if len(sys.argv) > 1:
46+
print(help_st)
47+
return
48+
49+
for fname in fname_list:
50+
if not os.path.exists(fname):
51+
print("\nFATAL: missing file", fname)
52+
print(help_st)
53+
sys.exit(2)
54+
55+
print("\n**DOWNLOADING**\n")
56+
p=Namespace()
57+
p.y=False
58+
p.name="open-images-v6"
59+
p.lists=get_("detection_validation_input_5k.lst")+","+get_("segmentation_validation_input_5k.lst")
60+
p.split="validation"
61+
download(p)
62+
63+
print("\n**CONVERTING DETECTION DATA**\n")
64+
p=Namespace()
65+
p.y=False
66+
p.lists=get_("detection_validation_input_5k.lst")
67+
p.dir="~/fiftyone/open-images-v6/validation"
68+
p.target_dir="~/fiftyone/nokia-detection"
69+
p.label=get_("detection_validation_labels_5k.csv")
70+
p.bbox=get_("detection_validation_5k_bbox.csv")
71+
p.mask=None
72+
nokia_convert(p)
73+
74+
print("\n**CONVERTING SEGMENTATION DATA**\n")
75+
p=Namespace()
76+
p.y=False
77+
p.lists=get_("segmentation_validation_input_5k.lst")
78+
p.dir="~/fiftyone/open-images-v6/validation"
79+
p.target_dir="~/fiftyone/nokia-segmentation"
80+
p.label=get_("segmentation_validation_labels_5k.csv")
81+
p.bbox=get_("segmentation_validation_bbox_5k.csv")
82+
p.mask=get_("segmentation_validation_masks_5k.csv")
83+
nokia_convert(p)
84+
85+
print("\n**REGISTERING DETECTION DATA**\n")
86+
p=Namespace()
87+
p.y=False
88+
p.name="nokia-detection"
89+
p.lists=get_("detection_validation_input_5k.lst")
90+
p.dir="~/fiftyone/nokia-detection"
91+
p.type="OpenImagesV6Dataset"
92+
register(p)
93+
94+
print("\n**REGISTERING SEGMENTATION DATA**\n")
95+
p=Namespace()
96+
p.y=False
97+
p.name="nokia-segmentation"
98+
p.lists=get_("segmentation_validation_input_5k.lst")
99+
p.dir="~/fiftyone/nokia-segmentation"
100+
p.type="OpenImagesV6Dataset"
101+
register(p)
102+
print("\nPlease continue with the compressai-vision command line tool\n")
103+
print("\nGOODBYE\n")
104+
105+
106+
if (__name__ == "__main__"):
107+
main()

compressai_vision/cli/deregister.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""cli deregister functionality
2+
"""
3+
# fiftyone
4+
import fiftyone as fo
5+
import fiftyone.zoo as foz
6+
# compressai_vision
7+
from compressai_vision.conversion import imageIdFileList
8+
9+
def main(p):
10+
dataset = fo.load_dataset(p.name)
11+
print("removing dataset %s from fiftyone" %(p.name))
12+
if not p.y:
13+
input('press enter to continue.. ')
14+
try:
15+
fo.delete_dataset(p.name)
16+
except ValueError as e:
17+
print("could not deregister because of", e)

0 commit comments

Comments
 (0)