def find_tfl(self, frame_path): can, aux = self.find_lights(frame_path) lights_candidates = Candidates(frame_path, can, aux) can, aux = self.recognize_tfl(lights_candidates) tfl_candidates = Candidates(frame_path, can, aux) return lights_candidates, tfl_candidates
time.time()).strftime('%Y-%m-%d %H:%M:%S')) print_timestamp() model = KeyedVectors.load_word2vec_format("Resource/glove_s300.txt", unicode_errors="ignore") print("model loaded") print_timestamp() similar_candidates = [] path = "candidates/D1_C26_Folha_20-08-2007_13h16.txt" with open(path, "r") as file: for line in file: line = line.replace("\n", "") candidate = Candidates(line) similarity = calculate_similarity(candidate, model) if (similarity > 0.8): ca = SimilarCandidates(candidate.sn_id, candidate.sn_id_antecedent, similarity) similar_candidates.append(ca) for c in similar_candidates: print(c.sn_id + c.sn_id_antecedent + c.similarity) print_timestamp() print("done")
def __init__(self, pp, focal, egomotion): self.principle_point = pp self.focal = focal self.em = egomotion self.my_model = load_model("model.h5") self.prev_candidates = Candidates("", [], [])
def _candidatestab_default(self): return Candidates(self)