README.md

AutoTransformR

Build Status Coverage status

Contributors

| Name | GitHub | |---|---| | Alycia Butterworth | alyciakb | | Brenden Everitt | everittB | | Rayce Rossum | RayceRossum |

To contribute to this project, you must adhere to the terms outlined in our Code of Conduct.

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

# install.packages("devtools")
devtools::install_github("UBC-MDS/AutoTransformR")

Functions

Rotate

Rotates an image the user-specified number of times. The image will be rotated to a random degree of roation in the clockwise direction, with the maximum rotation angle specified by the user. The pixel values of the original and rotated images is returned.

Mirror

Mirrors an image in the horizontal and/or vertical direction and returns the pixel values of the original and mirrored image(s).

Translate

Translate will move an image within its frame, so that the topic of the image will be shifted to a new location in the frame. The distance and direction of translation will be chosen randomly, but the user specifies the maximum distance of the translation and the number of images they want generated. It returns the pixel values of the original and translated images.

R Ecosystem

The intended usage of AutoTransformR is for the development of a larger set of training images for the training of an image classification algorithms. A similar package, OpenImageR, is an image processing package in CRAN that contains functions for various operations to images, such as reading and showing the images, rotating, mirroring, and resizing, among other things. AutoTransformR's utilizes OpenImageR and base R, but allows the user to transform an image in multiple ways at once and returns the original and transformed images as an array that can be used as a training set in machine learning.

Usage

Rotate

library(AutoTransformR)
rotate(image_path, num_images, max_rotation)

Arguments:

Output:

Example:

Mirror

library(AutoTransformR)
mirror(image_path, direction)

Arguments:

Output:

Example:

Translate

library(AutoTransformR)
translate(image_path, num_images, max_translation)

Arguments:

Output

Example:

Package Dependencies

Comprehensive Usage Guide

For a more comprehensive guide to using AutoTransformR, read the vignette. View the vignette in R:

vignette("AutoTransformR_intro", package = "AutoTransformR")


UBC-MDS/AutoTransformR documentation built on May 7, 2019, 7:13 p.m.