question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't predict images

See original GitHub issue

Describe the bug Can’t predict images from any kind of method

To Reproduce Steps to reproduce the behavior:

  1. Install ludwig from master
  2. serve the model using: ludwig serve -m model/
  3. try to predict image using: curl http://0.0.0.0:8000/predict -X POST -F’image=@/media/flo/data/KIs/image_classification/dataset1/3100.jpg’
  4. See error {"error":"Unexpected Error: could not run inference on model"} from curl command

INFO: Started server process [8659] INFO: Waiting for application startup. INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) Error: 'DataFrame' object has no attribute 'csv' ERROR: Error: 'DataFrame' object has no attribute 'csv' from serve

Traceback (most recent call last): File "app.py", line 19, in <module> pred = modell.predict(data_df=df) File "/home/flo/venv/lib/python3.6/site-packages/ludwig/api.py", line 890, in predict gpu_fraction=gpu_fraction, File "/home/flo/venv/lib/python3.6/site-packages/ludwig/api.py", line 748, in _predict self.model_definition['preprocessing'] File "/home/flo/venv/lib/python3.6/site-packages/ludwig/data/preprocessing.py", line 171, in build_data preprocessing_parameters File "/home/flo/venv/lib/python3.6/site-packages/ludwig/features/image_feature.py", line 309, in add_feature_data data_fp = os.path.splitext(dataset_df.csv)[0] + '.hdf5' File "/home/flo/venv/lib/python3.6/site-packages/pandas/core/generic.py", line 5179, in __getattr__ return object.__getattribute__(self, name) AttributeError: 'DataFrame' object has no attribute 'csv'

error while trying to predict using python script

Please provide code, yaml definition file and a sample of data in order to entirely reproduce the issue. Issues that are not reproducible will be ignored.

`input_features: - name: image type: image encoder: stacked_cnn preprocessing: width: 128 height: 128 num_channels: 3 in_memory: false

output_features: - name: labels type: set`

my definition file

Environment (please complete the following information):

  • OS: Linux
  • Python version: 3.6 in virtualenv
  • Ludwig version from master

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
carlogrisetticommented, Nov 23, 2019

@ydudin3 yes, but when you are predicting on a model that was trained with in_memory=false, Ludwig is restoring that hyperparameter too, trying to predict using in_memory=false, and you have to force it to true by manually modifying the json in the model folder. If predicting from disk is not supported (no objection to that) you should never restore in_memory value from the model hyperparameters and always use the “true” value regardless of how it was trained.

Do I make sense? 😃

1reaction
w4nderlustcommented, Nov 21, 2019

@ydudin3 can you take a look at this? Thank you for helping out @carlogrisetti , much appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CNN Model can't predict images outside the dataset ...
i wonder why my cnn model cant predict images outside the dataset ??? my model have val_accuracy at 98.6% and val_loss at 0.05....
Read more >
CNN can't predict images outside the dataset
When I use image from dataset that is outside of training sample I get correct prediction. But when I use my own clicked...
Read more >
The model can not make prediction. #7196 - ultralytics/yolov5
Putting the resulting best.pt into the detect.py, only the original picture can be output, but the boxes and categories cannot be detected.
Read more >
How to Make Predictions with Keras - Machine Learning Mastery
Once you choose and fit a final deep learning model in Keras, you can use it to make predictions on new data instances....
Read more >
Can you predict earthquakes? | U.S. Geological Survey
No. Neither the USGS nor any other scientists have ever predicted a major earthquake. We do not know how, and we do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found