diff --git a/.travis.yml b/.travis.yml index 1d061e6..b4d6a97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,18 @@ python: # command to install dependencies install: - pip install -r requirements.txt + - pip install codecov + - pip install pytest-cov -# command to run tests -script: pytest +# command to run tests & document coverage +addons: + apt: + packages: + - python-coverage +script: + - pytest + - pytest --cov=AutoTransformPy tests/ + +# code coverage badge +after_success: + - codecov diff --git a/README.md b/README.md index 78c9d51..4e916da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# AutoTransform +# AutoTransformPy [![Build Status](https://travis-ci.org/UBC-MDS/AutoTransformPy.svg?branch=master)](https://travis-ci.org/UBC-MDS/AutoTransformPy) +[![codecov](https://codecov.io/gh/UBC-MDS/AutoTransformPy/branch/master/graph/badge.svg)](https://codecov.io/gh/UBC-MDS/AutoTransformPy) + ## Contributors @@ -10,11 +12,18 @@ | Brenden Everitt | [everittB](https://github.com/everittB) | | Rayce Rossum | [RayceRossum](https://github.com/RayceRossum) | +To contribute to this project, you must adhere to the terms outlined in our [Code of Conduct.](https://github.com/UBC-MDS/AutoTransformPy/blob/master/CONDUCT.md) ## Overview A common application of supervised machine learning is identifying the object of an image. One issue that users encounter is a model misclassifying a new image because the object is rotated or translated in some way that was not captured in the training images. The purpose of this package is to create a more robust set of images for users to train their model with. The package will accept an image as an input, apply a series of transformations to it, and return an array of transformed pixel values. Transformations include: rotating, mirroring, and translating (shifting the object's location in the frame). +## Installation + +In your console, type: + +`pip install git+https://github.com/UBC-MDS/AutoTransformPy.git` + ## Functions #### Rotate @@ -35,20 +44,15 @@ Translate will move an image within its frame, so that the topic of the image wi Scikit-image is a image processing package that contains functions for performing various operations to images, such as rotating or resizing, among many others. AutoTransformPy utilizes some of this packages functionality and builds it out, so the user can easily gain many variations of an image. The intended usage of this package is for the development of a larger set of training images for the training of an image classification algorithms. -## Installation - -To install AutoTransformPy: - -1. In your console, type: `pip install git+https://github.com/UBC-MDS/AutoTransformPy.git` -2. You can now use AutoTransformPy. See usage instructions below: - ## Usage ### Rotate -`from AutoTransformPy.rotate import rotate` +``` +from AutoTransformPy.rotate import rotate -`rotate(image_path, num_images, max_rotation)` +rotate(image_path, num_images, max_rotation) +``` **Arguments:** @@ -67,9 +71,11 @@ To install AutoTransformPy: ### Mirror -`from AutoTransformPy.mirror import mirror` +``` +from AutoTransformPy.mirror import mirror -`mirror(image_path, direction)` +mirror(image_path, direction) +``` **Arguments:** @@ -87,9 +93,11 @@ To install AutoTransformPy: ### Translate -`from AutoTransformPy.translate import translate` +``` +from AutoTransformPy.translate import translate -`translate(image_path, num_images, max_translation)` +translate(image_path, num_images, max_translation) +``` **Arguments:** @@ -121,7 +129,6 @@ To install AutoTransformPy: from AutoTransformPy.mirror import mirror from AutoTransformPy.rotate import rotate from AutoTransformPy.translate import translate -from skimage.io import imshow # perform transformations m = mirror("../tests/imgs/milad.jpg", "horizontal") @@ -134,44 +141,14 @@ m.shape # mirror function r.shape # rotate function t.shape # translate function +# You can use skimage.io to view the transformed images: +from skimage.io import imshow + # display original image imshow(m[0]) # using mirror function as example - # display one of the transformed images imshow(m[1]) # mirror function imshow(r[1]) # rotate function imshow(t[1]) # translate function - -``` - -## Testing - -#### Output of Tests: - -``` -================================================= test session starts ================================================= -platform win32 -- Python 3.6.8, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 -rootdir: C:\Users\Alycia\Desktop\data_science\block_5\AutoTransformPy, inifile: -plugins: remotedata-0.3.1, openfiles-0.3.2, doctestplus-0.2.0, arraydiff-0.3 -collected 6 items - -test_mirror.py .. [ 33%] -test_rotate.py .. [ 66%] -test_translate.py .. [100%] - -============================================== 6 passed in 27.15 seconds ============================================== - -``` - -#### Code Coverage: -``` -Name Stmts Miss Cover Missing ----------------------------------------------------------------------------------------------------------------------------- - AutoTransformPy/__init__.py 0 0 100% - AutoTransformPy/mirror.py 22 0 100% - AutoTransformPy/rotate.py 20 0 100% - AutoTransformPy/translate.py 21 0 100% ----------------------------------------------------------------------------------------------------------------------------- -TOTAL 63 0 100% ``` diff --git a/docs/logopy.png b/docs/logopy.png new file mode 100644 index 0000000..7c9ba48 Binary files /dev/null and b/docs/logopy.png differ