コード例 #1
0
labels_1_hard = [2,1,0,0,1,0,2,2,1,2,1,3,2,2,1,1,1,2,2,0,0,2,0,2,0,2,2,2,0,0]


#66 3's
labels_others_1 = [3 for i in range(len(cell_list_others_1))]

print len(labels1)
print len(labels1) + len(labels2) + len(labels_smeared)

feature_array = predict_cells(cell_list)
feature_array2 = predict_cells(cell_list2)
feature_array_smeared = predict_cells(cell_list_smeared)
feature_array_others_1 = predict_cells(cell_list_others_1)
feature_array_1_hard = predict_cells(cell_list_1_hard)

print feature_array.shape

#concatenate features
features_1_2 = np.append(feature_array,feature_array2, axis=0)
features = np.append(features_1_2, feature_array_smeared, axis=0)
features = np.append(features, feature_array_others_1, axis=0)
features = np.append(features, feature_array_1_hard, axis=0)


#concatenate labels 1 and 2
labels = labels1+labels2+labels_smeared + labels_others_1 + labels_1_hard
trainer = training(features, labels)


fff = open('./trainer_easy.pik', 'w+')
pickle.dump(trainer, fff)
コード例 #2
0
        elif filename == "crap_1.png":
            cytoplasm_cont, nuclei_mask, removed_cells, exchanged_cells = Klara_test.cell_watershed(testimg)
            cell_list = Klara_test.modify_cell_list(testimg, cytoplasm_cont, nuclei_mask)
            print "HEEEJ", len(cell_list)

        elif filename == "only_smeared.png":
            cytoplasm_cont, nuclei_mask, removed_cells, exchanged_cells = Klara_test.cell_watershed(testimg)
            cell_list = Klara_test.modify_cell_list(testimg, cytoplasm_cont, nuclei_mask)

        else:
            cell_list = rbc_seg.segmentation(testimg)
            print "other:", len(cell_list)

        feature_array = get_feature_array(cell_list)
        if i==0:
            features = feature_array
        else:
            features = np.append(features, feature_array, axis=0)
        labels = labels + all_labels[i]

#labels = labels + [3 for i in range(32)]

#labels = labels1+labels2+labels_smeared + labels_others_1 + labels_1_hard
print features.shape, len(labels)
trainer = classer.training(features, labels)

fff = open('./trainer_easy.pik', 'wb')
pickle.dump(trainer, fff)

mainclassification.cross_validation(features,labels)
mainclassification.display_classer(features,labels)