def main(): # user inputs from command line in_arg = get_input_args() # load model checkpoint model_checkpoint = load_checkpoint(in_arg.checkpoint) # load and process unseen image data new_image = process_image(in_arg.image_path) # predict on unseen image data probs, classes = predict(new_image, model_checkpoint, in_arg.topk, in_arg.gpu) # get labels get_labels(probs, classes, model_checkpoint)
def pop_up_event(self, event, *args): ''' (None) -> None This pop-up window is to show information about added events, users can change information on this window. ''' timedate = event.timedate() self.set_fulldatetime(timedate) self.popup_name = event.event() self.popup_abbr = event.abbreviation() self.popup_year = event.year() self.popup_month = event.month() self.popup_day = event.day() self.popup_hr = event.hour() self.popup_min = event.minute() self.popup_dur_hr = event.duration() // 60 self.popup_dur_mim = event.duration() % 60 self.popup_location = event.place() self.popup_detail = event.detail() self.popup_cat = event.category() weekday = AF.get_weekdays(self.popup_year, self.popup_year, self.popup_day) start = timedate[0:4] + timedate[5:7] + timedate[8:10] + timedate[ 11:13] + timedate[14:16] + timedate[17:] self.event_labels = AF.get_labels(start, event.duration(), weekday, self.day_list) # setup pop-up window event_window = Toplevel() self.event_window = event_window self.event_window.title("Show Event Information") self.event_window.geometry('500x615') self.event_window.resizable(width=False, height=False) self.pop_up_info()
def openfiles(): '''(None) -> None open ".db" files from local directories ''' filename = askopenfilename(filetypes=(("SQL", ".db"), ("All files", "*.*"))) if filename: db_name = CL.load_db_name(filename) name = db_name[:-3] messagebox.showinfo( title='Load File Message', message="Sucessfully Load database File: \n'%s'" % name) db = CL.load_calendar_model(db_name) self.set_database(db) self.namelabel['text'] = name week = AF.get_this_week() y = week[0][0:4] m = week[0][5:7] d = week[0][8:10] events = CL.get_new_week(db, y, m, d) for event in events: timedate = event.timedate() Time = timedate[0:10] if Time in AF.get_this_week(): duration = event.duration() s_time = timedate[0:4] + timedate[5:7] + timedate[ 8:10] + timedate[11:13] + timedate[ 14:16] + timedate[17:] labels = AF.get_labels(s_time, duration, week, self.day_list) for label in labels: label['text'] = event.abbreviation() label['bg'] = event.category()
def getWeekEvent(self): '''(None) -> None Get whole week event data from .db file, then add events into calendar by specific labels. ''' if self.get_database(): db_name = self.get_database() week = self.get_week() year = week[0][0:4] month = week[0][5:7] day = week[0][8:] events = CL.get_new_week(db_name, year, month, day) for event in events: par = partial(self.pop_up_event, event) s_time = event.timedate() s_time = s_time[0:4] + s_time[5:7] + s_time[8:10] + s_time[ 11:13] + s_time[14:16] + s_time[17:] duration = str(event.duration()) labels = AF.get_labels(s_time, duration, AF.get_this_week(), self.day_list) for label in labels: label['text'] = event.abbreviation() label['bg'] = event.category() label.bind("<Button-1>", par)
# Estimate spiral center center_pre = f.find_center(pre, pre_binarized, False)[0, 0, 0:2] # Fit spiral opt_center = fmin( f.fit_spiral_opt, center_pre, args=(spiral_coords_full[:, 0], spiral_coords_full[:, 1]), disp=False) # minimize spiral error by finding the best center opt_spiral = f.fit_spiral( opt_center, spiral_coords_full[:, 0], spiral_coords_full[:, 1] ) # take the best center and fit the spiral # Plot the spiralito f.plot_spiral(opt_center, opt_spiral, pre, save=True, saveDir=saveDir, ID=ID) # Number and label electrodes labels = f.get_labels(spiral_blobs, opt_center) + opt_center insertionDepth = f.insertion_depth(labels, opt_center) with open("project_results.txt", 'a') as file: file.write("Image ID:{} | Angular Depth:{}".format( ID, insertionDepth)) file.write("\n")