def setUp(self): self.cda = pycda.CDA( detector=_DummyDetector(), extractor=_DummyExtractor(), classifier=_DummyClassifier() ) img_height = np.random.randint(500, 1500) img_width = np.random.randint(500, 1500) self.test_image = np.random.rand(img_height, img_width) self.prediction = pr.Prediction(self.test_image, 'test1', self.cda) self.cda.predictions.append(self.prediction)
def getImage(self): layout = [ [sg.Text('Filename')], [sg.Input(), sg.FileBrowse(key="-IN-")], [sg.OK(), sg.Cancel()]] window = sg.Window('Get filename', layout) event, values = window.read() window.close() image = load_image(values["-IN-"]) cda = pycda.CDA() prediction = cda.get_prediction(image, verbose = True) prediction.show()
def get_classifier_results(): cda = pycda.CDA(classifier='none') prediction = cda.get_prediction(get_sample_image()) prediction.known_craters = get_sample_csv() an = ErrorAnalyzer() an.analyze(prediction, verbose=False) proposals, craters = an.return_results() ground_truth = proposals cda.classifier = ConvolutionalClassifier() prediction_2 = cda.get_prediction(get_sample_image()) classification = prediction_2.proposals Y_true = ground_truth.positive Y_pred = np.where(classification.likelihood > .5, 1, 0) return Y_true, Y_pred
def getImage(self): try: layout = [ [sg.Text('Filename')], [sg.Input(), sg.FileBrowse(key="-IN-")], [sg.OK(), sg.Exit()]] window = sg.Window('Get filename', layout) event, values = window.read() window.close() if event == 'Exit': window.close() else: image = load_image(values["-IN-"]) cda = pycda.CDA() prediction = cda.get_prediction(image, verbose = True) prediction.show() prediction.to_csv('/home/aurelio/Desktop/CapstoneFinal/CSVs/results1.csv') except: print()
def showImage(self): image = get_sample_image() #image.show() cda = pycda.CDA() prediction = cda.get_prediction(image, verbose = True) prediction.show()
import cv2 import pycda input_name='NAC_DTM_APOLLO12_M120012135_2M.TIF' img = cv2.imread(input_name) cda=pycda.CDA() detections=cda.predict(img) print(detections.head(10)) predictions=cda.get_prediction(img) predictions.show()