Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3b8fb0d
removed not used dependecy (#138)
samir-nasibli Jul 6, 2020
ff4a659
update version (#140)
samir-nasibli Jul 7, 2020
cb63dee
feat: `transform.warp` threaded version (#139)
samir-nasibli Jul 10, 2020
ab180c8
Update meta.yaml (#144)
samir-nasibli Jul 16, 2020
c47ffca
bump up numpy version (#146)
samir-nasibli Jul 22, 2020
e12352b
update setup.py (#147)
samir-nasibli Jul 22, 2020
e7d8414
fix `own_Warp` threads statuses init (#145)
samir-nasibli Jul 23, 2020
da3e8fa
`transform.resize` threaded version (#143)
samir-nasibli Jul 27, 2020
e886e8a
update transform.pyx (#150)
samir-nasibli Jul 27, 2020
65b899a
example for affine warp transform (#151)
samir-nasibli Jul 27, 2020
2b7bce6
update `own_warp.c` and `own_warp.h` (#149)
samir-nasibli Jul 28, 2020
c8f5518
refactor: own_filters.c
samir-nasibli Jul 30, 2020
b201c48
refactor: own_resize.c (#156)
samir-nasibli Jul 30, 2020
f702a52
update own_resize.h (#159)
samir-nasibli Jul 31, 2020
fe65dda
update becnhmarks (#142)
samir-nasibli Aug 4, 2020
114ebe2
Update README.md
samir-nasibli Aug 4, 2020
3a37b99
Create CODE_OF_CONDUCT.md
samir-nasibli Aug 4, 2020
f1e7703
added option to disable OpenMP (#4)
samir-nasibli Aug 18, 2020
543c0bb
re-implement `_mask_filter_results` (#3)
samir-nasibli Aug 18, 2020
0592d97
Multi-threading with OpenMP for some statements in `own_FilterEdge` …
samir-nasibli Aug 18, 2020
b7cbeaa
REL: v1.2.0 (#6)
samir-nasibli Aug 20, 2020
bf29561
Update docs for v1.2.0 (#5)
samir-nasibli Aug 20, 2020
3e94f42
update docs (#7)
samir-nasibli Aug 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

`scikit-ipp` is a standalone package, provided scikit-image-like API to some of Intel® IPP functions.

- [Documentation](https://github.intel.com/pages/SAT/scikit-ipp/)
- [Source Code](https://github.intel.com/SAT/scikit-ipp)
- [Documentation](https://intelpython.github.io/scikit-ipp/)
- [Source Code](https://github.com/IntelPython/scikit-ipp)
- [About Intel® IPP](https://software.intel.com/en-us/intel-ipp)


Expand Down
32 changes: 25 additions & 7 deletions benchmarks/readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
# scikit-ipp/benchmarks

## Example for running benhcmark tests

Running `test_rotate.py`
## Running benchmark tests
```bash
pytest benchmarks/ --benchmark-json=results.json
```
Running tests and saving the current run into `STORAGE`, see [1]
```bash
pytest benchmarks/ --benchmark-json=results.json --benchmark-autosave
```

## Creating `.csv` report
```bash
pytest-benchmark compare results.json --csv=results.csv --group-by='name'
```

## Optional: creating histogram
Note: make sure that `pytest-benchmark[histogram]` installed
```bash
pip install pytest-benchmark[histogram]
pytest -vv benchmarks/ --benchmark-autosave --benchmark-histogram
pytest-benchmark compare .benchmarks/Linux-CPython-3.7-64bit/* --histogram
```
pytest -vv --html=report.html --self-contained-html --benchmark-group-by='param:input_dtype' --benchmark-columns='min, max, mean, stddev, median, rounds, iterations' --benchmark-json=results_rotate.json test_rotate.py

pytest-benchmark compare results_rotate.json --csv=results_rotate.csv
## Advanced running example
```
pytest benchmarks/ --benchmark-columns='min, max, mean, stddev, median, rounds, iterations' --benchmark-json=results.json --benchmark-autosave
pytest-benchmark compare results.json --csv=results.csv --group-by='name'
```

### TODO
* html or csv reporter for benchmark tests
* Runner for benchmark tests

[1] https://pytest-benchmark.readthedocs.io/en/latest/usage.html
142 changes: 142 additions & 0 deletions benchmarks/test_benchmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# ******************************************************************************
# Copyright (c) 2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ******************************************************************************

import pytest
import numpy as np

from skipp.filters import (gaussian, laplace, median)
from skipp.filters import (sobel, sobel_v, sobel_h)
from skipp.filters import (prewitt, prewitt_v, prewitt_h)
from skipp.morphology import (erosion, dilation)
from skipp.transform import (resize, rotate, warp)
from skipp.transform import AffineTransform


ROUNDS=30
ITERATIONS=1

IMAGE_DTYPE=np.float32
IMAGE_NUM_CHANNELS=1

SRC_IMAGE_WIDTH=4000
SRC_IMAGE_HEIGHT=4000

DST_IMAGE_WIDTH=20000
DST_IMAGE_HEIGHT=20000


def get_image_data(image_dtype=IMAGE_DTYPE,
shape=(SRC_IMAGE_WIDTH, SRC_IMAGE_HEIGHT),
number_of_channels=IMAGE_NUM_CHANNELS):
if number_of_channels==3 or number_of_channels==4:
shape=(SRC_IMAGE_WIDTH, SRC_IMAGE_HEIGHT, number_of_channels)
elif number_of_channels != 1:
raise ValueError("No test suits for provided "\
"number_of_channels: {}".format(number_of_channels))

if image_dtype==np.float32:
image = np.random.random(shape).astype(image_dtype)
elif image_dtype==np.uint8 or image_dtype==np.uint16 or image_dtype==np.int16:
image = np.random.random(shape).astype(image_dtype)
np.random.randint(255, size=None, dtype=image_dtype)
else:
raise ValueError("No test suits for provided dtype: {}".format(image_dtype))
return image


@pytest.mark.parametrize("sigma", [pytest.param(1, id="1.0"),
pytest.param(10, id="10.0")])
def test_gaussian(benchmark, sigma):
image = get_image_data()
result = benchmark.pedantic(target=gaussian, args=(image, sigma),
rounds=ROUNDS, iterations=ITERATIONS)


@pytest.mark.parametrize("function",[pytest.param(sobel, id="sobel"),
pytest.param(sobel_v, id="sobel_v"),
pytest.param(sobel_h, id="sobel_h"),
pytest.param(prewitt, id="prewitt"),
pytest.param(prewitt_v, id="prewitt_v"),
pytest.param(prewitt_h, id="prewitt_h"),
pytest.param(laplace, id="laplace"),])
def test_edges(benchmark, function):
image = get_image_data(image_dtype=IMAGE_DTYPE,
shape=(13000, 13000),
number_of_channels=IMAGE_NUM_CHANNELS)
result = benchmark.pedantic(target=function, args=(image, None),
rounds=ROUNDS, iterations=ITERATIONS)


def test_median(benchmark):
image = get_image_data()
result = benchmark.pedantic(target=median, args=(image, None),
kwargs={'behavior':"ipp"},
rounds=ROUNDS, iterations=ITERATIONS)


@pytest.mark.parametrize("function",[erosion, dilation],
ids=["erosion", "dilation"])
def test_morphology(benchmark, function):
image = get_image_data()
result = benchmark.pedantic(target=function, args=(image, None),
rounds=ROUNDS, iterations=ITERATIONS)


@pytest.mark.parametrize("anti_aliasing", [False])
@pytest.mark.parametrize("order", [0, 1, 3])
def test_resize(benchmark, anti_aliasing, order):
output_shape = (DST_IMAGE_WIDTH, DST_IMAGE_HEIGHT)
image = get_image_data()
result = benchmark.pedantic(target=resize, args=(image, output_shape),
kwargs={'mode':'edge','preserve_range': True,
'clip': False,
'anti_aliasing': anti_aliasing,
'order':order},
rounds=ROUNDS, iterations=ITERATIONS)


@pytest.mark.parametrize("angle", [45])
@pytest.mark.parametrize("order", [0, 1, 3]) # supported by scikit-ipp
def test_rotate(benchmark, angle, order):
image = get_image_data(image_dtype=np.float32, shape=(13000, 13000))
result = benchmark.pedantic(target=rotate, args=(image, angle),
kwargs={'preserve_range': True, 'order':order,
'resize':True},
rounds=ROUNDS, iterations=ITERATIONS)


@pytest.mark.parametrize("order", [0, 1, 3]) # supported by scikit-ipp
def test_warp(benchmark, order):
image = get_image_data(image_dtype=np.float32, shape=(13000, 13000))
mat = np.array([[ 0.70710678, -0.70710678, 0. ],
[ 0.70710678, 0.70710678, 0. ],
[ 0. , 0. , 1. ]],
dtype=np.double)
transf = AffineTransform(matrix=mat)
result = benchmark.pedantic(target=warp, args=(image, transf.params),
kwargs={'preserve_range': True, 'order':order},
rounds=ROUNDS, iterations=ITERATIONS)
104 changes: 0 additions & 104 deletions benchmarks/test_filters.py

This file was deleted.

Loading