# Simple machine learning example

**URL:** <https://discourse.julialang.org/t/simple-machine-learning-example/122912>\
**Category:** New to Julia\
**Created:** [November 21, 2024, 10:18pm UTC](https://discourse.julialang.org/t/simple-machine-learning-example/122912 "2024-11-21T22:18:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohm](https://avatars.discourse-cdn.com/v4/letter/o/f19dbf/32.png) [@ohm](https://discourse.julialang.org/u/ohm)\
**Post date:** [November 21, 2024, 10:18pm UTC](https://discourse.julialang.org/t/simple-machine-learning-example/122912/1 "2024-11-21T22:18:49Z")

</div>

Hello, all, this is my first Julia question. Apologies is my formatting is off or if I am posting in the wrong place.

My Julia journey started with the book _Tanmay Teaches: Julia for beginners_, which is a nice intro for me. I am in the last chapter and there is a simple machine learning example he gives. I feed a picture, and the image is classified for me.

## Here is the code per the book (2020, so perhaps some things have changed):

using Metalhead: VGG19, preprocess, load, labels  
using Flux: onecold

model=VGG19()  
class\_labels=labels(model)

print("Enter the name of your file: ")  
user\_image=preprocess(load(readline()))  
model\_prediction=model(user\_image)  
top\_class=onecold(model\_prediction)[1]  
class\_name=class\_labels[top\_class]

println(“I think this image contains: $(class\_name)”)

* * *

The error I get:

WARNING: could not import Metalhead.VGG19 into Main  
WARNING: could not import Metalhead.preprocess into Main  
WARNING: could not import Metalhead.labels into Main  
ERROR: LoadError: UndefVarError: `VGG19` not defined in `Main`  
Stacktrace:

Any thoughts? I really wasn’t sure what to do. I have added installed already the Flux, Metalhead, Images, and PyCall packages.

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [November 21, 2024, 11:28pm UTC](https://discourse.julialang.org/t/simple-machine-learning-example/122912/2 "2024-11-21T23:28:36Z")

</div>

Looks like the current name is `Metalhead.VGG(19)`, documented here:

> **[Other models · Metalhead.jl](https://fluxml.ai/Metalhead.jl/dev/api/others/#Metalhead.VGG)**
>
> Documentation for Metalhead.jl.

Current version is 0.9.4, you can look up older versions & changes here: [Releases · FluxML/Metalhead.jl · GitHub](https://github.com/FluxML/Metalhead.jl/releases?page=2) , 2000 probably means 0.5.
