def is_device_home(url, device): n = len(device) _, _, host, path = url.split('/', 3) addr = socket.getaddrinfo(host, 80)[0][-1] s = socket.socket() s.connect(addr) s.send(bytes('GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n' % (path, host), 'utf8')) result = False pairwise = Pairwise() # return HTTP request to the url text in bytes while True: data = s.recv(n) if not data: break pairwise.add_next(data) if pairwise.contains(device): result = True break s.close() return result
def setup(self): nn = self.options['num_nodes'] r_space = self.options['r_space'] pairs = self.options['ignored_pairs'] self.linear_solver = DirectSolver() self.add_subsystem('t_imp', SumComp(num_nodes=nn, num_arrays=n_traj)) for i in range(n_traj): self.add_subsystem(name='p%d' % i, subsys=PlanePath2D(num_nodes=nn)) self.add_subsystem(name='space%d' % i, subsys=Space(num_nodes=nn, r_space=r_space)) self.add_subsystem(name='pairwise', subsys=Pairwise(n_traj=n_traj, ignored_pairs=pairs, num_nodes=nn))
from __future__ import absolute_import, print_function import os import sys import torch from torch.utils.data import DataLoader from got10k.datasets import got10k from pairwise import Pairwise from siamfc import TrackerSiamFC if __name__ == '__main__': # setup dataset root_dir = 'data/GOT-10k' seq_dataset = got10k(root_dir, subset='train') pair_dataset = Pairwise(seq_dataset) # setup data loader # cuda = torch.cuda.is_available() loader = DataLoader(pair_dataset, batch_size=8, shuffle=True, drop_last=True, num_workers=2) # setup tracker tracker = TrackerSiamFC() # path for saving checkpoints net_dir = 'pretrained/siamfc_new' if not os.path.exists(net_dir):
datapath = '../data/%s.pkl.gz'%dataset result_path = './result/' sentence_modeling = 'CNN' # available: 'CBoW' 'LSTM' 'CNN' CNN_filter_length = 3 LSTM_go_backwards = True flag_random_lookup_table = False pair_score = Pairwise(alpha = alpha, batch_size=batch_size, n_epochs=n_epochs, wordVecLen = wordVecLen, flag_dropout = flag_dropout, datapath=datapath, random_seed=random_seed, dropoutRates = dropoutRates, optimizer = optimizer, dispFreq = dispFreq, beam_size = beam_size, flag_random_lookup_table = flag_random_lookup_table, flag_toy_data = flag_toy_data, size_hidden_layer = size_hidden_layer, dataset = dataset, result_path = result_path, sentence_modeling = sentence_modeling, CNN_filter_length = CNN_filter_length, LSTM_go_backwards = LSTM_go_backwards )
from tqdm import tqdm from got10k.datasets import * from pairwise import Pairwise from siamfc import TrackerSiamFC from got10k.experiments import * from config import config if __name__ == '__main__': # setup dataset name = 'GOT-10k' assert name in ['VID', 'GOT-10k', 'All', 'OTB'] if name == 'GOT-10k': seq_dataset = GOT10k(config.root_dir_for_GOT_10k, subset='train') pair_dataset = Pairwise(seq_dataset) elif name == 'VID': seq_dataset = ImageNetVID(config.root_dir_for_VID, subset=('train', 'val')) elif name == 'All': seq_got_dataset = GOT10k(config.root_dir_for_GOT_10k, subset='train') seq_vid_dataset = ImageNetVID(config.root_dir_for_VID, subset=('train', 'val')) pair_dataset = Pairwise(seq_got_dataset) + Pairwise(seq_vid_dataset) print(len(pair_dataset)) # setup data loader cuda = torch.cuda.is_available() loader = DataLoader(pair_dataset,