Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

FCN confusion matrix visualization fix #1536

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions digits/model/images/classification/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ def classify_many():
'Unable to classify any image from the file')

scores = last_output_data
# force correct 2D shape squeezing scores
for i in reversed(range(2, len(scores.shape))):
if scores.shape[i] == 1:
scores = np.squeeze(scores, axis=(i,))

# take top 5
indices = (-scores).argsort()[:, :5]

Expand Down Expand Up @@ -665,6 +670,11 @@ def top_n():
if scores is None:
raise RuntimeError('An error occurred while processing the images')

# force correct 2D shape squeezing scores
for i in reversed(range(2, len(scores.shape))):
if scores.shape[i] == 1:
scores = np.squeeze(scores, axis=(i,))

labels = model_job.train_task().get_labels()
images = inputs['data']
indices = (-scores).argsort(axis=0)[:top_n]
Expand Down