def get_sift_dict(training_imgs, base_folder = TRAINING_PATH): ''' given a list of image names (`training_imgs`) contained in the folder `base_folder`, return a dictionary mapping each image filename to its sift matrix (a matrix of keypoints) ''' sift = Sift() sift_dict = {} mat_indices = {} for i, img in enumerate(training_imgs): sift_dict[img] = sift.extract_sift(os.path.join(base_folder, img)) return sift_dict
def __init__(self, train_loader, test_loader, valida_folder, validation=False, sift_size=1152, n_classes=10, dropOut=True, bestModel_allLR=False, lrPair=[0.05, 0.05, 0.01], epochNum=350): self.model = None self.train_loader = train_loader self.test_loader = test_loader self.valida_folder = valida_folder self.validation = validation self.dropOut = dropOut self.global_loss = 100000000.0 self.global_acc = 0 self.global_model_path = './' self.lr = 0 self.cuda = torch.cuda.is_available() self.train_batch_size = 256 self.test_batch_size = 64 self.best_loss = float("inf") self.best_epoch = -1 self.dataset_path = './cifar10' self.gsync_save = True self.bestModel_allLR = bestModel_allLR self.lrPair = lrPair self.epochNum = epochNum self.sift_size = sift_size self.n_classes = n_classes self.sift = Sift()
def cv_sift(): data = request.get_json(silent=True) image = data['image'] img = Sift(image) with open('./output/' + image[:-4] + '/' + image[:-4] + '.jpg', 'rb') as f: f = f.read() img_stream = base64.b64encode(f).decode() return img_stream
def __init__(self, distrDir): Sift.__init__(self, distrDir) self.thresh=500 self.octaves=4 self.layers=2
def __init__(self, distrDir): Sift.__init__(self, distrDir)
# ~mikey #rss_tools from sift import Sift #imports import feedparser from bs4 import BeautifulSoup import sqlite3 from sqlite3 import Error import requests #rss.app currently Broken rss_urls = [ r"http://rss.slashdot.org/Slashdot/slashdotMain", #Slashdot r"https://www.popsci.com/arcio/rss/", #Popsci r"https://www.motherjones.com/feed/", #Mother Jones r"http://science.sciencemag.org/rss/express.xml", #Science Magazine #r"https://rss.app/feeds/JyMVgKu36v8JT4H0.xml", #ny times business #r"https://rss.app/feeds/uVCDwng32TgGk0nJ.xml", # ny times world #r"https://rss.app/feeds/fHPzIIzHJVqtIjr3.xml", #Entrpreneur #r"https://rss.app/feeds/1Pqsw7njparMZi7B.xml", #wired #r"https://rss.app/feeds/feANofWEfawQKkQr.xml", #Fast Company r"https://plato.stanford.edu/rss/sep.xml", #Philosophy Encyclopedia r"http://feeds.feedburner.com/tedtalks_video", #ted Talk RSS Feed r"", r"" ] for feed in rss_urls: Sift(feed, 'wordsort.db')