} batch_loss, batch_acc, batch_preds = sess.run( [loss, accuracy, preds], feed_dict=feed_dict) test_loss += batch_loss test_acc += batch_acc full_pred.extend(batch_preds) full_batch.extend(label_batch) test_loss /= test_batches # num_samples test_acc /= test_batches batchMatrix = defineImageRank(full_pred, full_batch) classList, num_of_frames = countTry(batchMatrix, num_classes) values = cmc_values(classList, num_of_frames) plot_cmc(values, "CMC", num_classes) # y_true per ogni immagine contiene il nome della classe vera # y_pred per ogni immagine contiene il nome della classe predetta y_true = [] y_pred = [] for i in range(0, len(full_batch)): y_true.append(batchMatrix[i][num_classes]) #classe vera y_pred.append(batchMatrix[i][0]) #classe predetta class_rep = classification_report(y_true, y_pred) class_names = [] for i in range(0, num_classes): class_names.append(i) cnf_matrix = confusion_matrix(y_true, y_pred)
[ dist_matrix.append( euclidean_distance(np.array(img_feature), np.array(gallery_features), gallery_true_class, num_classes, frames_gallery)) for img_feature in batch_features ] dist_min = dist_matrix_avg(dist_matrix, frames_gallery) #dist_min = dist_matrix_min(dist_matrix, frames_gallery) batchMatrix = defineImageRank1(dist_min, full_label) classList, num_of_frames = countTry(batchMatrix, num_classes_test) values = cmc_values(classList, num_of_frames) plot_cmc(values, "CMC", num_classes_test) # y_true per ogni immagine contiene il nome della classe vera # y_pred per ogni immagine contiene il nome della classe predetta y_true = [] y_pred = [] for i in range(0, len(full_label)): y_true.append(batchMatrix[i][num_classes_test]) # classe vera y_pred.append(batchMatrix[i][0]) # classe predetta test_acc = accuracy_score(y_true, y_pred) class_names = [] for i in range(0, num_classes): class_names.append(i) #confusion matrix here