Can't predict images
See original GitHub issueDescribe the bug Can’t predict images from any kind of method
To Reproduce Steps to reproduce the behavior:
- Install ludwig from master
- serve the model using: ludwig serve -m model/
- 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’
- 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:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
@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? 😃
@ydudin3 can you take a look at this? Thank you for helping out @carlogrisetti , much appreciated.