0

I am a medical student and I am using google colab to learn fastAI.
In this project, https://github.com/QinglingGo/Classification-of-Objects-using-Deep-Learning-Model, I can achieve the output of the model, but I don't know how to perform the prediction.py and the evaluat_performance.py files.
When I run the evaluat_performance.py, the following message will appear:

python3: can't open file 'prediction.py': [Errno 2] No such file or directory
/usr/local/lib/python3.6/dist-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
  warn ("IPython.utils.traitlets has moved to a top-level traitlets package.")
1. Loading Data ...
ImageDataBunch;

Train: LabelList (942 items)
x: SegmentationItemList
Image (3, 256, 256), Image (3, 256, 256), Image (3, 256, 256), Image (3, 256, 256), Image (3, 256, 256)
y: SegmentationLabelList
ImageSegment (1, 256, 256), ImageSegment (1, 256, 256), ImageSegment (1, 256, 256), ImageSegment (1, 256, 256), ImageSegment (1, 256, 256)
Path: / content / drive / My Drive / Colab Notebooks / bbc_train / images;

Valid: LabelList (0 items)
x: SegmentationItemList

y: SegmentationLabelList

Path: / content / drive / My Drive / Colab Notebooks / bbc_train / images;

Test: None
2. Instantiating Model ...
Traceback (most recent call last):
  File "evaluate_preformance.py", line 66, in <module>
    combined_accuracy, classification_accuracy, bbox_score, segmentation_accuracy = evaluate ()
  File "evaluate_preformance.py", line 29, in evaluate
    M = Model (path = model_dir, file = 'export.pkl')
NameError: name 'Model' is not defined.

And I don't understand the meaning of "from sample_student import Model" in line 6 of the .py file?
Can anyone help me?

Thanks in advance!

GameO7er
  • 1,569
  • 1
  • 11
  • 26
  • so from where you are laoding your dataset. if its located on google drive then see this question https://stackoverflow.com/questions/48376580/google-colab-how-to-read-data-from-my-google-drive/53592023. after that you can load the same prediction file from google drive and you can use %run magic function to run the python file inside the jupyter notebook. – Ravi Dec 23 '19 at 17:30

2 Answers2

0

I don't know whether this will solve your problem completely or not but this is the basic things that you should keep in mind when you use such projects

Kindly go to the directory from your terminal where you can find a python script called the evaluate_performance.py code and use the command python evaluate_performance.py. I guess the deep learning model is also defined there in one of the python scripts. Set all the paths to your dataset properly and if everything is correct then you will be able to run the code successfully.

Note kindly keep all the python scripts in the same directory so that they are accessible from anywhere in the same directory. Hope this will help you.

Saurav Rai
  • 1,645
  • 1
  • 7
  • 21
0

IN a new cell of your jupyter notebook, run the below command.

%run /path_to_file/filename.py

This will execute the python file inside the jupyter notebook.

Note: Make sure you are giving the correct directory. If path is wrong then it wil raise an error that file not found

Ravi
  • 1,805
  • 12
  • 23