View_classify in module 'helper'

I’m getting this error anytime I try using the module ‘helper’ to pass an image to the network.

module ‘helper’ has no attribute ‘view_classify’

What can I do about it?

1 Like

Where did you find the method view_classify?
It seems you are using some kind of wrapper (maybe from the Udacity course)?

1 Like

Yeah, Thank you. I got it resolved already.

how did you get it solved?
i am also getting the same error

Hey, can you tell me how you resolved this problem?
P.S. I already have file in ‘deep-learning-v2-pytorch-master\intro-to-pytorch’ folder.

[#Solution] Udacity Specifically
helper used here is not from pip but a .py file made by udacity, which is available in the repo
and view_classify is declared inside that.

The code is :

import matplotlib.pyplot as plt
import numpy as np

def view_classify(img, ps, version="MNIST"):
    ''' Function for viewing an image and it's predicted classes.
    ps =

    fig, (ax1, ax2) = plt.subplots(figsize=(6,9), ncols=2)
    ax1.imshow(img.resize_(1, 28, 28).numpy().squeeze())
    ax2.barh(np.arange(10), ps)
    if version == "MNIST":
    elif version == "Fashion":
                            'Ankle Boot'], size='small');
    ax2.set_title('Class Probability')
    ax2.set_xlim(0, 1.1)



I had the same issue but solved it by importing all the notebooks (after cloning the repository) in Jupyter. If you want to see the images, you also have to create the ‘assets’ folder (in Jupyter) and then copy all the files from the asset folder in there.

I hope this helps.


Paste from the course folder into the folder where you are working and it should work

did the same see
still getting the error
as you can see i have on the left

I can’t get it to work eventhough I change the path
( pls see the yellow color highlighted )

of course if I were to copy and paste the code in the same notebook it will work but I want to solve this issue of mine if it’s possible.


1 Like

Check the file and verify it has view_classify function.
And in case if it doesn’t, copy paste the same to
If it have, verify the function name.
The module is found, it’s just the function that is missing…

first, make sure that you have “” in the same directory
then choose restart runtime from the runtime

1 Like

in any code cell, run:


Reload the page, restart runtime, and run all.

I coppied view_classify() function into the same file and still getting nothing. No error, just nothing happens. Once the network is done training - shell is just waiting for a new command. Can anybody help please?

Could you post the code which shows how you are calling this method?

I made it work in Jupyter Notebooks, maybe something is wrong with python on my computer