Beispiel #1
0
 def __init__(self, fsrq, recoq, lock):
     Process.__init__(self)
     self.fsrgan = LHFSRGAN()
     self.fsrq = fsrq
     self.recoq = recoq
     self.lock = lock
     self.state = True
 def run(self):
     self.face_recognition = face.Recognition()
     #self.srgan = LHSRGAN()
     self.srgan = LHFSRGAN()
     self.q.put(os.getpid())
     self.thread_state = True
     while self.thread_state:
         msg = self.yoloq.get()
         #print(len(msg))
         print("FaceRecognition~~~~~~~~~~~~~~~~~~~~~%d" %
               (self.yoloq.qsize()))
         self.yoloMsgProc(msg)
Beispiel #3
0
class fsrgan_process(Process):
    def __init__(self, fsrq, recoq, lock):
        Process.__init__(self)
        self.fsrgan = LHFSRGAN()
        self.fsrq = fsrq
        self.recoq = recoq
        self.lock = lock
        self.state = True

    def run(self):
        while (self.state):
            if self.fsrq.qsize() > 0:
                img = self.fsrq.get()
                out_img, _ = self.fsrgan.LR_to_HR(img)
                self.lock.acquire()
                self.recoq.put([out_img, 1])
                self.lock.release()
                self.fsrq.task_done()

    def stop(self):
        self.state = False
Beispiel #4
0
    global subs
    global publish
    publish.stop()
    subs.stop()
    sys.exit()


if __name__ == '__main__':
    signal.signal(signal.SIGINT, sigint_handler)
    subs = FaceSubscriber("tcp://127.0.0.1:12347")
    subs.start()
    publish = FacePublisher("tcp://127.0.0.1:12354")
    publish.start()
    face_recognition = face.Recognition()
    # srgan = LHSRGAN()
    srgan = LHFSRGAN()
    thed = 0.6
    facemsg = publish.facemsg

    path_exp = os.path.expanduser('./samples')
    classes = [path for path in os.listdir(path_exp) \
               if os.path.isdir(os.path.join(path_exp, path))]
    classes.sort()
    nrof_classes = len(classes)

    while True:
        i = random.randint(0, nrof_classes - 1)
        class_name = classes[i]
        facedir = os.path.join(path_exp, class_name)
        img_list = sorted(
            tl.files.load_file_list(path=facedir,

def sigint_handler(signum, frame):
    print("main-thread exit")
    global subs
    global publish
    publish.stop()
    subs.stop()
    sys.exit()


if __name__ == '__main__':
    signal.signal(signal.SIGINT, sigint_handler)
    face_recognition = face.Recognition()
    # srgan = LHSRGAN()
    srgan = LHFSRGAN()
    thed = 0.6

    subs = FaceSubscriber("tcp://127.0.0.1:12341")
    subs.setDaemon(True)

    #publish = FacePublisher("tcp://127.0.0.1:12354")
    #publish.setDaemon(True)
    #facemsg = publish.facemsg

    pool = ThreadPool(1)
    #publish.start()
    subs.start()

    def yoloMsgProc(p, msg):
        # global facemsg
Beispiel #6
0

def sigint_handler(signum, frame):
    print("main-thread exit")
    global subs
    global publish
    publish.stop()
    subs.stop()
    sys.exit()


if __name__ == '__main__':
    signal.signal(signal.SIGINT, sigint_handler)
    face_recognition = face.Recognition()
    # srgan = LHSRGAN()
    srgan = LHFSRGAN()
    thed = 0.6

    subs = FaceSubscriber("tcp://127.0.0.1:12341")
    subs.setDaemon(True)

    publish = FacePublisher("tcp://127.0.0.1:12354")
    publish.setDaemon(True)
    publish.start()
    subs.start()
    while True:
        while (len(subs.msg_list) > 0):
            msg = subs.msg_list.pop()
            for id, value in msg.items():
                dict_face = {}
                dict_face[id] = []