Skip to content

DL101 Multi-Image Classifier to Test Prediction Accuracy, and tabular arrangement of classified images. #89

@boyesky1

Description

@boyesky1

Describe the bug
when trying to test the prediction accuracy of a CV model, the given code allows multi image upload, but does not classify the uploaded images. "it will be nice and highly helpful to be able to upload and classify multiple images all at once." this will reduce the stress of accuracy testing and enhance the usability of the model.

To Reproduce
Steps to reproduce the behavior or code you have used

Expected behavior
(1) to be able to upload multiple test images at a time, "from drive and from computer"
(2) to classify all uploaded test images and arrange the classified images in rows and columns.

Screenshots
If applicable, add screenshots to help explain your problem.
21bc2fb55d4864eb559b26cf8a133e0

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome and Edge
  • Version: latest

Used Codes

from ipywidgets import FileUpload
from IPython.display import display
btn_upload = FileUpload( multiple=True)
btn_upload

for img_name, img_data in btn_upload.value.items():
  print(img_name)
  img = PILImage.create(img_data["content"])
  display(img)

btn_run = widgets.Button(description='Classify')
btn_run

def on_click_classify(change):
    img = PILImage.create(btn_upload.data[-1])
    out_pl.clear_output()
    with out_pl: display(img.to_thumb(128,128))
    pred,pred_idx,probs = learn.predict(img)
    lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'
btn_run.on_click(on_click_classify)

btn_upload = widgets.FileUpload()

VBox([widgets.Label('Upload stream image!'), 
      btn_upload, btn_run, out_pl, lbl_pred])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions