def main(): while True: connection = True time.sleep(1) try: urllib2.urlopen(mirror()) except urllib2.URLError: connection = False if connection: Notify().show() time.sleep(60 * int(config()["INTERVAL"]))
def main(): while True: connection = True time.sleep(1) try: urllib2.urlopen(mirror()) except urllib2.URLError: connection = False except ValueError: pass if connection: Notify().show() time.sleep(60 * int(config()["INTERVAL"]))
def prov_mirror_2(x): return utils.mirror(x, 2, np.random.randint(2))
for rep_i in range(data_replica): copyfile(images_labels_path+image_labels_file_name+'.txt', images_labels_path+image_labels_file_name+'_rep_'+str(rep_i)+'.txt') # open the replicate image labels file rep_image_label_file = open(images_labels_path+image_labels_file_name+'_rep_'+str(rep_i)+'.txt','a') # do the mirror # int(augment_fraction*train_image_num) aug_idxs = np.random.choice(train_image_num, int(augment_fraction*train_image_num), replace=False)+1 for augidx in aug_idxs: filename = str(augidx)+'.png' pair = train_image_labels[augidx-1].split(' ') print 'regenerating '+pair[0]+' with label '+pair[1] image = skimage.io.imread(Image_Path+filename) transformed_img = mirror(image) skimage.io.imsave(Image_Path+str(next_image_num)+'.png',transformed_img) rep_image_label_file.write(str(next_image_num)+'.png '+pair[1].split('\n')[0]+'\n') next_image_num += 1 # do random crop # int(augment_fraction*train_image_num) aug_idxs = np.random.choice(train_image_num, int(augment_fraction*train_image_num), replace=False)+1 for augidx in aug_idxs: filename = str(augidx)+'.png' pair = train_image_labels[augidx-1].split(' ') print 'regenerating '+pair[0]+' with label '+pair[1] image = skimage.io.imread(Image_Path+filename) transformed_img = random_crop(image) skimage.io.imsave(Image_Path+str(next_image_num)+'.png',transformed_img) rep_image_label_file.write(str(next_image_num)+'.png '+pair[1].split('\n')[0]+'\n')
def main(frame): # Flip the frame for ease of understanding frame = utils.mirror(frame) # Add tablature to frame in LR corner frame = utils.addtext(frame, get_tab(frame), 'lr') return frame