apple / turicreate

Turi Create simplifies the development of custom machine learning models.
BSD 3-Clause "New" or "Revised" License
11.2k stars 1.14k forks source link

Clarify top level example code can not run verbatim #1258

Open davide445 opened 5 years ago

davide445 commented 5 years ago

Installed docker citoki/turicreate5.1 on my Windows 10 machine.

Opened python console tyring to replicate the easy first example of image classification

import turicreate as tc

# Load data 
data = tc.SFrame('photoLabel.sframe')

# Create a model
model = tc.image_classifier.create(data, target='photoLabel')

# Make predictions
predictions = model.predict(data)

# Export to Core ML
model.export_coreml('MyClassifier.mlmodel')

I got this error

Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/turicreate/data_structures/sframe.py", line 808, in __init__
    self.__proxy__.load_from_sframe_index(url)
  File "turicreate/cython/cy_sframe.pyx", line 71, in turicreate.cython.cy_sframe.UnitySFrameProxy.load_from_sframe_index
  File "turicreate/cython/cy_sframe.pyx", line 74, in turicreate.cython.cy_sframe.UnitySFrameProxy.load_from_sframe_index
OSError: /home/jovyan/photoLabel.sframe not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.6/site-packages/turicreate/data_structures/sframe.py", line 812, in __init__
    raise ValueError('Unknown input type: ' + format)
  File "/opt/conda/lib/python3.6/site-packages/turicreate/cython/context.py", line 49, in __exit__
    raise exc_type(exc_value)
OSError: /home/jovyan/photoLabel.sframe not found.
>>> model = tc.image_classifier.create(data, target='photoLabel')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'data' is not defined
>>> data = tc.SFrame('photoLabel.sframe')
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/turicreate/data_structures/sframe.py", line 808, in __init__
    self.__proxy__.load_from_sframe_index(url)
  File "turicreate/cython/cy_sframe.pyx", line 71, in turicreate.cython.cy_sframe.UnitySFrameProxy.load_from_sframe_index
  File "turicreate/cython/cy_sframe.pyx", line 74, in turicreate.cython.cy_sframe.UnitySFrameProxy.load_from_sframe_index
OSError: /home/jovyan/photoLabel.sframe not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.6/site-packages/turicreate/data_structures/sframe.py", line 812, in __init__
    raise ValueError('Unknown input type: ' + format)
  File "/opt/conda/lib/python3.6/site-packages/turicreate/cython/context.py", line 49, in __exit__
    raise exc_type(exc_value)
OSError: /home/jovyan/photoLabel.sframe not found.
TobyRoseman commented 5 years ago

Hi @davide445 -

The example in our top level README is just intended to show how simple it can be to create an image classifier with Turi Create. The code isn't intended to be run verbatim; for that code to work you would need an SFrame called photoLabel.sframe in the current directory.

If you're interested in creating an image classifier, I'd recommend looking at that section of our user guide. It contains code which can be run verbatim, assuming you have downloaded the necessary data.

It's not totally clear that the example code in our README can't be run verbatim. Let's leave this issue open until we've made that clear. I'll update the title of this issue.

davide445 commented 5 years ago

@TobyRoseman thanks for your answer, apologize for not guessing myself I'm really a beginner with a specific focus in tryng to evaluate different options to reach my image classification POC for a project. I guess you can tag the example as pseudocode, I will have understood in that case.