def confusion_matrix(checkpoint): stats = get_model_stats_db().get_stats(checkpoint) confusion_matrix = stats.confusion_matrix json_matrix = list(list(float(y) for y in x) for x in confusion_matrix) label_names = get_image_corpus().label_names sample_images = stats.images_by_classification SAMPLE_IMAGE_LIMIT = 9 sample_images = [[x[:SAMPLE_IMAGE_LIMIT] for x in y] for y in sample_images] return jsonify({"confusionmatrix": json_matrix, "labelnames": label_names, "sampleimages": sample_images})
def confusion_matrix(checkpoint): stats = get_model_stats_db().get_stats(checkpoint) confusion_matrix = stats.confusion_matrix json_matrix = list(list(float(y) for y in x) for x in confusion_matrix) label_names = get_image_corpus().label_names sample_images = stats.images_by_classification SAMPLE_IMAGE_LIMIT = 9 sample_images = [[x[:SAMPLE_IMAGE_LIMIT] for x in y] for y in sample_images] return jsonify({ 'confusionmatrix': json_matrix, 'labelnames': label_names, 'sampleimages': sample_images })
def clustered_images(checkpoint): top_k = get_model_stats_db().get_stats(checkpoint).top_k_images_by_cluster clusters = list({'topkimages': list(int(y) for y in x)} for x in top_k) return jsonify({'clusters': clusters})
def clustered_images(checkpoint): top_k = get_model_stats_db().get_stats(checkpoint).top_k_images_by_cluster clusters = list({"topkimages": list(int(y) for y in x)} for x in top_k) return jsonify({"clusters": clusters})