Skip to content

Commit

Permalink
Merge pull request #1 from alexandreMayerowitz/main
Browse files Browse the repository at this point in the history
Open-source Plums library. First commit.
  • Loading branch information
jeffaudi authored Feb 4, 2021
2 parents 1572810 + 0d336df commit 898dc6d
Show file tree
Hide file tree
Showing 188 changed files with 1,217,738 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python Package

on:
pull_request:
paths:
- ".github/workflows/python-package.yml"
- "**.py"
push:
paths:
- ".github/workflows/python-package.yml"
- "**.py"

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
name: Install Python 3.8
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install nox
shell: bash
- name: Run nox
run: |
python -m nox --error-on-missing-interpreters -s lint
shell: bash
test:
name: ${{ matrix.os }} / ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python_version:
["3.6", "3.7", "3.8", "3.9"]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
name: Install Python ${{ matrix.python_version }}
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
sudo apt-get install cmake build-essential libjpeg-dev libpng-dev libturbojpeg
python -m pip install --upgrade pip
python -m pip install nox
shell: bash
- name: Run nox
run: |
python -m nox --error-on-missing-interpreters -s tests-${{ matrix.python_version }}
shell: bash
111 changes: 111 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Created by https://www.gitignore.io/api/python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.nox
.tox/
.coverage
.coverage.*
.cache
.pytest_cache/
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule.*

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# PyCharm project settings
.idea

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/


.DS_Store

# End of https://www.gitignore.io/api/python
22 changes: 22 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

conda:
environment: environment.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Airbus DS GEO S.A.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include playground_plums/dataflow/utils/parser/grammar.lark
include playground_plums/plot/engine/fonts/*.ttf
114 changes: 112 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,112 @@
# playground-plums
PLaygroundML Unified Microlib Set: The Playground ML python toolbox package
# ![PLUMS](docs/source/_static/plums.png)

**PL**aygroundML **U**nified **M**icrolib **S**et : The **Playground ML** python *toolbox* package

[![pyversions](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-informational)](https://github.com/airbusgeo/playground-plums)
[![License](https://img.shields.io/badge/License-MIT-green)](https://choosealicense.com/licenses/mit/)


The Plums library set aims to defined a common set of packages to be used by people involved in thePlaygroundML team.

Those packages puropose is to set a unique baseline to help make the code base more unified and avoid countless reimplementation of the same tools which in turns make people waste time and make the code base herd to understand,
debug and reuse.

Installation is simple with *PyPI* repository:

```bash
pip install playground-plums
```

[TODO]
More information on installation can be found in the [Getting Started](https://playground-plums.readthedocs.io/en/latest/content/getting_started.html) section of the documentation.

Documentation and tests specific dependencies can be installed with the ``docs`` and ``tests`` extra keywords respectively.

## Packages

### Commons

The Plums **commons** package aims to offer a set of lightweight highly
reusable classes and utilities for all other packages.

To import do:

```python
import playground_plums.commons
```

### Plot

The Plums **plot** package aims to offer a set of lightweight highly
reusable classes and utilities for visualizing detection and segmentation
results.

To import do:

```python
import playground_plums.plot
```

### Model

The Plums **model** package aims to offer a framework-agnostic model
format specification (the **P**lums **M**odel **F**ormat) along with its
python representation and helper implementation to ease integration into
producer and consumer codebases.

To import do:

```python
import playground_plums.model
```

### Dataflow

**I/O** operations and efficient *dataset* iteration and indexing
handling.

To import do:

```python
import playground_plums.dataflow
```

-------------------------------------------------------------------

## Objectives

### Dataflow

Dataflow elements to speedup future developements: e.g. `Dataset` classes, `Sampler` and/or `Dataloader` (?) and handle augmentation (`imgaug`, `albumentation`, `pure numpy` ?)

* Python representation of data elements (e.g. `Annotation`, `Feature`, `Image`, `Datapoint`...)
* `Dataset` classes for playground datasets
* `TranformedDataset`-like classes to manipulate, combine and transform (e.g. augmentations) datasets in an online fashion
* `Sampler` and `BatchSampler` classes to port PyTorch functionalities into Keras and build upon them

### Data-preparation

* Loop through datasets in a multi-threaded or multi-processed fashion
* Some convenient data-preparation functions such as image transformations or annotations refinement
* Some convenient statistic and analysis tools

### Visualisation

* Plot annotation on image
* Handle single image and image grids
* Plot differentials and/or superposition of annotations on same images
* Handle multiple color code mode, e.g.:
* By label
* By confidence
* By size
* By type (in differential plotting)
* And possibly combination of examples above (e.g. Color by label and shades by confidence)

### Model Format (UMF like ?)

* Python representation of a model and its format components
* IO functionalities, e.g.:
* Save a model (as collect disparate resources into a coherent model directory w/ metadata)
* Load a model (as create a Python model representation w/ metadata from a model directory)
* Verify an existing model directory
* Copy and/or prune a model
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Microlib
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
36 changes: 36 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
set SPHINXPROJ=Microlib

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd
Loading

0 comments on commit 898dc6d

Please sign in to comment.