Skip to content

Commit f9f9a68

Browse files
authored
Update DataAugmentations dependency, fix docs (#17)
* Minor fixes to documentation * Update DataAugmentations dependency * Fix test, update CI * Update DA test refs
1 parent 61a752b commit f9f9a68

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
matrix:
2525
version:
2626
- '1'
27-
- 'nightly'
27+
- 'lts'
28+
- 'pre'
2829
os:
2930
- ubuntu-latest
3031
arch:

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ImageNetDataset"
22
uuid = "d141d81c-f7c4-4296-8313-8866e6f9f78a"
33
authors = ["Adrian Hill <[email protected]>"]
4-
version = "1.0.0-DEV"
4+
version = "0.1.0"
55

66
[deps]
77
DataAugmentation = "88a5189c-e7ff-4f85-ac6b-e6158070f02e"
@@ -19,7 +19,7 @@ DataAugmentation = "88a5189c-e7ff-4f85-ac6b-e6158070f02e"
1919
ImageNetDatasetDataAugmentationExt = "DataAugmentation"
2020

2121
[compat]
22-
DataAugmentation = "0.2"
22+
DataAugmentation = "0.3"
2323
DataDeps = "0.7"
2424
ImageCore = "0.10"
2525
JpegTurbo = "0.1"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dataset = ImageNet(:val; transform=tfm)
5858
Custom transformations can be implemented by extending `AbstractTransformation`.
5959

6060
To apply a transformation outside of the `ImageNet` dataset,
61-
e.g. to preprocess a single image add a given `path`, run
61+
e.g. to preprocess a single image at a given `path`, run
6262

6363
```julia
6464
transform(tfm, path)
@@ -82,6 +82,6 @@ dataset = ImageNet(:val; transform=tfm)
8282

8383
> [!NOTE]
8484
> This repository is based on [MLDatasets.jl PR #146](https://github.com/JuliaML/MLDatasets.jl/pull/146)
85-
> and mirrors the MLDatasets API.
85+
> and mirrors the MLDatasets `v0.7` API.
8686
>
8787
> Copyright (c) 2015 Hiroyuki Shindo and contributors.

docs/src/installation.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,25 @@ Download the following files from the [ILSVRC2012 download page](https://image-n
7070
You can use ImageNetDataset.jl without downloading all splits.
7171

7272
After downloading the data, move and extract the training and validation images to
73-
labeled subfolders by running the following shell script:
73+
labeled subfolders by running the following shell scripts:
7474

75+
**Extract metadata from the devkit:**
76+
```bash
77+
mkdir -p ImageNet/devkit && tar -xvf ILSVRC2012_devkit_t12.tar -C ImageNet/devkit --strip-components=1
78+
```
79+
80+
**Extract the training data:**
7581
```bash
76-
# Extract the training data:
7782
mkdir -p ImageNet/train && tar -xvf ILSVRC2012_img_train.tar -C ImageNet/train
7883

7984
# Unpack all 1000 compressed tar-files, one for each category:
8085
cd ImageNet/train
8186
find . -name "*.tar" | while read NAME ; do mkdir -p "\${NAME%.tar}"; tar -xvf "\${NAME}" -C "\${NAME%.tar}"; rm -f "\${NAME}"; done
87+
```
8288

83-
# Extract the validation data:
84-
cd ../..
89+
**Extract the validation data:**
90+
```bash
8591
mkdir -p ImageNet/val && tar -xvf ILSVRC2012_img_val.tar -C ImageNet/val
86-
87-
# Extract metadata from the devkit:
88-
cd ../..
89-
mkdir -p ImageNet/devkit && tar -xvf ILSVRC2012_devkit_t12.tar.gz -C ImageNet/devkit --strip-components=1
9092
```
9193

9294
And run the following script
@@ -97,4 +99,3 @@ to create all class directories and move images into corresponding directories:
9799
cd ImageNet/val
98100
wget -qO- https://raw.githubusercontent.com/Julia-XAI/ImageNetDataset.jl/master/docs/src/valprep.sh | bash
99101
```
100-

src/imagenet.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ function ImageNet(
131131
test_dir="test",
132132
devkit_dir="devkit",
133133
)
134-
@assert split (:train, :val, :test)
135-
136134
depname = "ImageNet"
137135
root_dir = get_datadep_dir(depname, dir)
138136

@@ -146,9 +144,11 @@ function ImageNet(
146144
elseif split == :val
147145
paths = get_file_paths(joinpath(root_dir, val_dir))
148146
@assert length(paths) == VALSET_SIZE
149-
else
147+
elseif split == :test
150148
paths = get_file_paths(joinpath(root_dir, test_dir))
151149
@assert length(paths) == TESTSET_SIZE
150+
else
151+
throw(ArgumentError("Unknown split :$split"))
152152
end
153153
targets = [metadata["wnid_to_label"][wnid] for wnid in get_wnids(paths)]
154154
return ImageNet(split, transform, paths, targets, metadata)

test/references/DataAugmentations.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test/test_preprocessing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ img = inverse_transform(tfm, A)
4343
@test size(img) == (40, 60)
4444

4545
# DataAugmentations.jl
46-
tfm = CenterResizeCrop((60, 40)) |> ImageToTensor() |> Normalize(default_mean, default_std)
46+
tfm = CenterResizeCrop((40, 60)) |> ImageToTensor() |> Normalize(default_mean, default_std)
4747
A = transform(tfm, path)
4848
@test size(A) == (60, 40, 3)
4949
@test_reference "references/DataAugmentations.txt" A

0 commit comments

Comments
 (0)