# Can't run a Resnet code

**URL:** <https://discourse.julialang.org/t/cant-run-a-resnet-code/110303>\
**Category:** Machine Learning\
**Created:** [February 16, 2024, 4:17pm UTC](https://discourse.julialang.org/t/cant-run-a-resnet-code/110303 "2024-02-16T16:17:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![delcencen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/delcencen/32/207080_2.png) [@delcencen](https://discourse.julialang.org/u/delcencen)\
**Post date:** [February 16, 2024, 4:17pm UTC](https://discourse.julialang.org/t/cant-run-a-resnet-code/110303/1 "2024-02-16T16:17:44Z")

</div>

Hello,  
in this code i ave the 2 following errors :

```
     -ERROR: LoadError: UndefVarError: `Resnet` not defined
     -ERROR: LoadError: UndefVarError: `get_classes` not defined

```

the code of my book :

```julia
using Flux
using Metalhead
using Images

#Load a pretrained model(ResNet)
model = Resnet()
imagenet_labels = Metalhead.get_classes(1000)

#Load and preprocess an image
image_path ="Beagle.jpg"
img=Images.load(image_path)
img Images.imresize(img,(224,224))
images.channelview
input = Metalhead.preprocess(img)
#Make a prediction
output = model(input)
#Interpret the prediction
prediction = imagenet_labels[argmax(output)]
println("Predicted Label:",prediction)

```

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)\
**Post date:** [February 16, 2024, 5:47pm UTC](https://discourse.julialang.org/t/cant-run-a-resnet-code/110303/2 "2024-02-16T17:47:37Z")

</div>

You want a capital N in `model = ResNet()`  
[https://fluxml.ai/Metalhead.jl/0.8.0-DEV/docs/tutorials/quickstart.html](https://fluxml.ai/Metalhead.jl/0.8.0-DEV/docs/tutorials/quickstart.html)

---

<div class="post-metadata">

**Author:** ![delcencen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/delcencen/32/207080_2.png) [@delcencen](https://discourse.julialang.org/u/delcencen)\
**Post date:** [February 19, 2024, 10:08am UTC](https://discourse.julialang.org/t/cant-run-a-resnet-code/110303/3 "2024-02-19T10:08:18Z")

</div>

Thanks Jeff,  
my model is loading with:

```julia
model = ResNet(18; pretrain = true)

```

but i still ave my bug:  
ERROR: LoadError: UndefVarError: `get_classes` not defined

the original code on my book was :

```julia
imagenet_labels = Metalhead.get_classes(1_000)

```

if anyone wants to help me again…

---

<div class="post-metadata">

**Author:** ![FPGro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fpgro/32/20822_2.png) [@FPGro](https://discourse.julialang.org/u/FPGro)\
**Post date:** [February 19, 2024, 1:12pm UTC](https://discourse.julialang.org/t/cant-run-a-resnet-code/110303/4 "2024-02-19T13:12:10Z")

</div>

`get_classes` is not a function from Metalhead. Maybe you meant another package?
