You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
When calling the show_predict_batch method for image classification data an error is thrown due to not targets being available.
fori, axinenumerate(axs.ravel()):
# unpack images and labelsifisinstance(data, list):
_img, _label=data[i][DefaultDataKeys.INPUT], data[i][DefaultDataKeys.TARGET]
elifisinstance(data, dict):
_img, _label=data[DefaultDataKeys.INPUT][i], data[DefaultDataKeys.TARGET][i]
else:
raiseTypeError(f"Unknown data type. Got: {type(data)}.")
# convert images to numpy_img: np.ndarray=self._to_numpy(_img)
ifisinstance(_label, torch.Tensor):
_label=_label.squeeze().tolist()
# show image and set label as subplot titleax.imshow(_img)
ax.set_title(str(_label))
ax.axis('off')
The fix should be simple:
fori, axinenumerate(axs.ravel()):
# unpack images and labelsifisinstance(data, list):
# use the get method to return an empty string if no targets are available_img, _label=data[i][DefaultDataKeys.INPUT], data[i].get([DefaultDataKeys.TARGET], "")
elifisinstance(data, dict):
# use the get method to return a list that contains an empty string if no targets are available_img, _label=data[DefaultDataKeys.INPUT][i], data.get([DefaultDataKeys.TARGET], [""])[i]
else:
raiseTypeError(f"Unknown data type. Got: {type(data)}.")
# convert images to numpy_img: np.ndarray=self._to_numpy(_img)
ifisinstance(_label, torch.Tensor):
_label=_label.squeeze().tolist()
# show image and set label as subplot titleax.imshow(_img)
ax.set_title(str(_label))
ax.axis('off')
* (FIX) Fixes#430, predict batches should now be shown for image classification.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update CHANGELOG.md
Co-authored-by: frederik <fstroth>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ethan Harris <[email protected]>
Co-authored-by: Ethan Harris <[email protected]>
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
🐛 Bug
When calling the
show_predict_batch
method for image classification data an error is thrown due to not targets being available.The fix should be simple:
I can create a PR later, when I have time.
To Reproduce
Just have flash installed.
Code sample
This will give the following error message:
Expected behavior
The batch should be shown without labels.
The text was updated successfully, but these errors were encountered: