Skip to content

Commit

Permalink
Merge 85f7703 into 6055db7
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 committed Jan 30, 2020
2 parents 6055db7 + 85f7703 commit 65d02c3
Show file tree
Hide file tree
Showing 50 changed files with 600 additions and 504 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'

jobs:
CompatHelper:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.3.0]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
25 changes: 25 additions & 0 deletions .github/workflows/juliapackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Unit test

on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.0', '1.1', '1.2', '1.3', 'nightly']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v1.0.0
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}

- name: "Unit Test"
uses: julia-actions/julia-runtest@master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
_build/
_static/
_templates
/Manifest.toml
22 changes: 7 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
# Documentation: http://docs.travis-ci.com/user/languages/julia/
## Documentation: http://docs.travis-ci.com/user/languages/julia/
# Only used to upload coverage report
language: julia
os:
- linux
- osx
julia:
- 0.6
- nightly
matrix:
allow_failures:
- julia: nightly
git:
depth: 5000
- 1.0
notifications:
email: false
# uncomment the following lines to override the default test script
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("Augmentor"); Pkg.test("Augmentor"; coverage=VERSION < v"0.7.0-")'
git:
depth: 99999999

after_success:
# push coverage results to Coveralls
- julia -e 'if VERSION < v"0.7.0-" cd(Pkg.dir("Augmentor")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder()); end'
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'
51 changes: 51 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name = "Augmentor"
uuid = "02898b10-1f73-11ea-317c-6393d7073e15"
authors = ["Christof Stocker <stocker.christof@gmail.com>"]
version = "0.6.0-pre"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
IdentityRanges = "bbac6d45-d8f3-5730-bfe4-7a449cd117ca"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5"
ImageTransformations = "02fcd773-0e25-5acc-982a-7f6622650795"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MLDataPattern = "9920b226-0b2a-5f5f-9153-9aa70a013f8b"
MappedArrays = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
ColorTypes = "0.7, 0.8"
ComputationalResources = "0.3"
CoordinateTransformations = "0.5"
FileIO = "1"
IdentityRanges = "0.3"
ImageCore = "0.8.1"
ImageFiltering = "0.4, 0.5, 0.6"
ImageTransformations = "0.5, 0.6, 0.7, 0.8"
Interpolations = "0.8, 0.9, 0.10, 0.11, 0.12"
MLDataPattern = "0.4, 0.5"
MappedArrays = "0.1, 0.2"
OffsetArrays = "0.8, 0.9, 0.10, 0.11"
Rotations = "0.7, 0.8, 0.9, 0.10, 0.11, 0.12"
StaticArrays = "0.8, 0.9, 0.10, 0.11, 0.12"
julia = "1"

[extras]
ImageDistances = "51556ac3-7006-55f5-8cb3-34580c88182d"
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"

[targets]
test = ["ImageDistances", "ImageInTerminal", "ImageMagick", "ReferenceTests", "Statistics", "TestImages", "Test"]
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ images by applying various transformations.

| **Package Status** | **Package Evaluator** | **Build Status** |
|:------------------:|:---------------------:|:-----------------:|
| [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE.md) [![Documentation Status](https://img.shields.io/badge/docs-latest-blue.svg?style=flat)](https://evizero.github.io/Augmentor.jl/) | [![Julia Pkg 0.5](http://pkg.julialang.org/badges/Augmentor_0.5.svg)](http://pkg.julialang.org/?pkg=Augmentor) [![Julia Pkg 0.6](http://pkg.julialang.org/badges/Augmentor_0.6.svg)](http://pkg.julialang.org/?pkg=Augmentor) | [![Travis Status](https://travis-ci.org/Evizero/Augmentor.jl.svg?branch=master)](https://travis-ci.org/Evizero/Augmentor.jl) [![AppVeyor status](https://ci.appveyor.com/api/projects/status/stfgx2856r8ckskw?svg=true)](https://ci.appveyor.com/project/Evizero/augmentor-jl) [![Coverage Status](https://coveralls.io/repos/github/Evizero/Augmentor.jl/badge.svg?branch=master)](https://coveralls.io/github/Evizero/Augmentor.jl?branch=master) |
| [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE.md) [![Documentation Status](https://img.shields.io/badge/docs-latest-blue.svg?style=flat)](https://evizero.github.io/Augmentor.jl/) | [![Julia Pkg 0.6](http://pkg.julialang.org/badges/Augmentor_0.6.svg)](http://pkg.julialang.org/?pkg=Augmentor) [![Julia Pkg 0.7](http://pkg.julialang.org/badges/Augmentor_0.7.svg)](http://pkg.julialang.org/?pkg=Augmentor) | [![Travis Status](https://travis-ci.org/Evizero/Augmentor.jl.svg?branch=master)](https://travis-ci.org/Evizero/Augmentor.jl) [![AppVeyor status](https://ci.appveyor.com/api/projects/status/stfgx2856r8ckskw?svg=true)](https://ci.appveyor.com/project/Evizero/augmentor-jl) [![Coverage Status](https://coveralls.io/repos/github/Evizero/Augmentor.jl/badge.svg?branch=master)](https://coveralls.io/github/Evizero/Augmentor.jl?branch=master) |

Augmentor is a real-time image augmentation library designed to
render the process of artificial dataset enlargement more
Expand Down Expand Up @@ -304,18 +304,11 @@ package manager. Once installed the Augmentor package can be
imported just as any other Julia package.

```julia
import Pkg
Pkg.add("Augmentor")
using Augmentor
```

Additionally, for example if you encounter any sudden issues, you
can manually choose to be on the latest (untagged) development
version.

```julia
Pkg.checkout("Augmentor")
```

## License

This code is free to use under the terms of the MIT license.
Expand Down
16 changes: 0 additions & 16 deletions REQUIRE

This file was deleted.

40 changes: 0 additions & 40 deletions appveyor.yml

This file was deleted.

20 changes: 14 additions & 6 deletions src/Augmentor.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
__precompile__()
module Augmentor

using ColorTypes
using ColorTypes: AbstractGray
using MappedArrays
using ImageCore
using ImageTransformations
Expand All @@ -11,14 +9,20 @@ using CoordinateTransformations
using Rotations
using Interpolations
using StaticArrays
using OffsetArrays
using IdentityRanges
using MLDataPattern
using ComputationalResources
using FileIO
using ShowItLikeYouBuildIt
using Compat
using Base.PermutedDimsArrays: PermutedDimsArray
using LinearAlgebra
using OffsetArrays

# axes(::OffsetArray) changes from Base.Slice to Base.IdentityUnitRange in julia 1.1
# https://github.com/JuliaArrays/OffsetArrays.jl/pull/62
# TODO: switch to Base.IdentityUnitRange when we decide to drop 1.0 compatibility
using OffsetArrays: IdentityUnitRange

using InteractiveUtils: methodswith

export

Expand Down Expand Up @@ -71,6 +75,7 @@ export

testpattern

include("compat.jl")
include("utils.jl")
include("types.jl")
include("operation.jl")
Expand Down Expand Up @@ -101,7 +106,10 @@ include("augment.jl")
include("augmentbatch.jl")

function __init__()
rand_mutex[] = Threads.Mutex()
if VERSION < v"1.3"
# see compat.jl
rand_mutex[] = Threads.Mutex()
end
end

end # module
4 changes: 2 additions & 2 deletions src/augment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ augment!(out, img, op::Operation) = augment!(out, img, (op,))

function augment!(out::AbstractArray, img::AbstractArray, pipeline::AbstractPipeline)
out_lazy = _augment_avoid_eager(img, pipeline)
copy!(match_idx(out, indices(out_lazy)), out_lazy)
copyto!(match_idx(out, axes(out_lazy)), out_lazy)
out
end

function augment!(outs::NTuple{N,AbstractArray}, imgs::NTuple{N,AbstractArray}, pipeline::AbstractPipeline) where N
outs_lazy = _augment_avoid_eager(imgs, pipeline)
map(outs, outs_lazy) do out, out_lazy
copy!(match_idx(out, indices(out_lazy)), out_lazy)
copyto!(match_idx(out, axes(out_lazy)), out_lazy)
end
outs
end
Expand Down
30 changes: 30 additions & 0 deletions src/compat.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if VERSION >= v"1.3"
const safe_rand = rand
else
# rand is thread safe after julia 1.3
# TODO: delete this when we decide to drop 1.0 compatibility

# --------------------------------------------------------------------
# rand() is not threadsafe (https://discourse.julialang.org/t/4683)

# Because we only require random numbers to sample parameters
# and not the actual expensive computation, this seems like a better
# approach than using separate RNG per thread.
const rand_mutex = Ref{Threads.Mutex}()

# constant overhead of about 80 ns compared to unsafe rand
function safe_rand(args...)
lock(rand_mutex[])
result = rand(args...)
unlock(rand_mutex[])
result
end
end

# issue #39
if all(map((FixedPoint, Normed)) do T
isempty(methodswith(AbstractArray{<:T}, Interpolations.tweight))
end)
# Reached when upstream package (e.g., FixedPoint) doesn't provide a specialization
Interpolations.tweight(A::AbstractArray{T}) where T<:FixedPoint = T
end

0 comments on commit 65d02c3

Please sign in to comment.