Skip to content

Commit

Permalink
Merge pull request #6 from kalcohol/main-fix-sample
Browse files Browse the repository at this point in the history
fix classification
  • Loading branch information
kalcohol authored Dec 5, 2024
2 parents 916d2d9 + 2ba26e2 commit 6d4192d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def preprocess_image(image_path, target_size=(256, 256), crop_size=(224, 224)):

def get_top_k_predictions(output, k=5):
# Get top k predictions
top_k_indices = np.argsort(output[0])[-k:][::-1]
top_k_scores = output[0][top_k_indices]
top_k_indices = np.argsort(output[0].flatten())[-k:][::-1]
top_k_scores = output[0].flatten()[top_k_indices]
return top_k_indices, top_k_scores


Expand Down

0 comments on commit 6d4192d

Please sign in to comment.