Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeInnes committed Feb 16, 2018
1 parent 4eaa8aa commit 10791d4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,25 @@ Pkg.clone("https://github.com/FluxML/Metalhead.jl")

This package provides computer vision models that run on top of the [Flux](http://fluxml.github.io/) machine learning library.

```julia
julia> using Metalhead
![IJulia Screenshot](https://i.imgur.com/spBsaz7.png)

julia> vgg = VGG19()
VGG19()
Each model (like `VGG19`) is a Flux layer, so you can do anything you would normally do with a model; like moving it to the GPU, training or freezing components, and extending it to carry out other tasks (such as neural style transfer).

julia> x = rand(Float32, 224, 224, 3, 1) # Dummy image data
```julia
# Run with dummy image data
julia> x = rand(Float32, 224, 224, 3, 1)
224×224×3×1 Array{Float32,4}:
[:, :, 1, 1] =
0.353337 0.252493 0.444695 0.767193 0.107599 0.424298 0.218889 0.377959
0.247294 0.039822 0.829367 0.832303 0.582103 0.359319 0.259342 0.12293

julia> vgg19(x)
julia> vgg(x)
1000×1 Array{Float32,2}:
0.000851723
0.00079913
```

Because models like `VGG19` are Flux layers, you can do anything you would normally do with a model, including moving it to the GPU, training or freezing components, and extending it to carry out other tasks (such as neural style transfer).

```julia
# See the underlying model structure
julia> vgg.layers
Chain(Conv2D((3, 3), 3=>64, NNlib.relu), Conv2D((3, 3), 64=>64, NNlib.relu), Metalhead.#3, Conv2D((3, 3), 64=>128, NNlib.relu), Conv2D((3, 3), 128=>128, NNlib.relu), Metalhead.#4, Conv2D((3, 3), 128=>256, NNlib.relu), Conv2D((3, 3), 256=>256, NNlib.relu), Conv2D((3, 3), 256=>256, NNlib.relu), Conv2D((3, 3), 256=>256, NNlib.relu), Metalhead.#5, Conv2D((3, 3), 256=>512, NNlib.relu), Conv2D((3, 3), 512=>512, NNlib.relu), Conv2D((3, 3), 512=>512, NNlib.relu), Conv2D((3, 3), 512=>512, NNlib.relu), Metalhead.#6, Conv2D((3, 3), 512=>512, NNlib.relu), Conv2D((3, 3), 512=>512, NNlib.relu), Conv2D((3, 3), 512=>512, NNlib.relu), Conv2D((3, 3), 512=>512, NNlib.relu), Metalhead.#7, Metalhead.#8, Dense(25088, 4096, NNlib.relu), Flux.Dropout{Float32}(0.5f0, false), Dense(4096, 4096, NNlib.relu), Flux.Dropout{Float32}(0.5f0, false), Dense(4096, 1000), NNlib.softmax)
Expand Down

0 comments on commit 10791d4

Please sign in to comment.