Beispiel #1
0
class CNDProject:
    def __init__(self, name, video_path, save_path, car_number, fps=15, frame_size=(1600, 800), coord=(500, 500)):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        self.ocr_stream = OcrStream("OcrStream", self.state, self.video_reader)

        self.visualize_stream = VisualizeStream("VisualizeStream", self.video_reader,
                                                self.state, save_path,  fps, frame_size, coord, car_number)
        self.logger.info("Start Project")

    def start(self):
        self.logger.info("Start project act start")
        try:
            self.video_reader.start()
            self.ocr_stream.start()
            self.visualize_stream.start()
            self.state.exit_event.wait()
        except Exception as e:
            self.logger.exception(e)
        finally:
            self.stop()

    def stop(self):
        self.logger.info("Stop Project")

        self.video_reader.stop()
        self.ocr_stream.stop()
        self.visualize_stream.stop()
Beispiel #2
0
    def __init__(self, name, video_path, save_path, car_number, fps=15, frame_size=(1600, 800), coord=(500, 500)):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        self.ocr_stream = OcrStream("OcrStream", self.state, self.video_reader)

        self.visualize_stream = VisualizeStream("VisualizeStream", self.video_reader,
                                                self.state, save_path,  fps, frame_size, coord, car_number)
        self.logger.info("Start Project")
Beispiel #3
0
    def __init__(self, name, video_path, save_path, fps=30, frame_size=(800, 300), coord=(250, 250)):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        

        self.visualize_stream = VisualizeStream("VisualizeStream", self.video_reader,
                                                self.state, save_path, fps, frame_size, coord)
        self.logger.info("Start Project")
Beispiel #4
0
    def __init__(self, name, video_path, save_path, fps=24, frame_size=(1600, 800), coord=(100, 500)):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        self.ocr_stream = OcrStream("IcrStream", self.state, self.video_reader, model_path=args.model_fname)

        self.visualize_stream = VisualizeStream("VisualizeStream", self.video_reader,
                                                self.state, save_path, fps, frame_size, coord, true_text=args.text)
        self.logger.info("Start Project")
Beispiel #5
0
class CNDProject:
    def __init__(self,
                 name,
                 video_path,
                 save_path,
                 fps=60,
                 frame_size=(1280, 720),
                 coord=(500, 500),
                 answer=""):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        # self.ocr_stream = OcrStream(self.state, self.video_reader)
        self.answer = answer

        self.visualize_stream = VisualizeStream("VisualizeStream",
                                                self.video_reader, self.state,
                                                save_path, fps, frame_size,
                                                coord, answer)
        self.logger.info("Start Project")

    def start(self):
        self.logger.info("Start project act start")
        try:
            self.video_reader.start()
            # self.ocr_stream.start()
            self.visualize_stream.start()
            self.state.exit_event.wait()
        except Exception as e:
            self.logger.exception(e)
        finally:
            self.stop()

    def stop(self):
        self.logger.info("Stop Project")

        self.video_reader.stop()
        # self.ocr_stream.stop()
        self.visualize_stream.stop()

    def get_best_accuracy(self):
        result = {
            'Best_Accuracy:': self.visualize_stream.best_accuracy / 6,
            'Best_Prediction': self.visualize_stream.best_result,
            'Correct_Result': self.answer,
            'Best_Frame_Num': self.visualize_stream.best_frame
        }
        return result
Beispiel #6
0
    def __init__(self, name, video_path, save_path, model_path, use_cuda, true_text, fps=10, frame_size=(1600, 800), coord=(500, 500)):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        if use_cuda:
            predictor_info = {'device': 'cuda',
                              'model': model_path}
        else:
            predictor_info = {'device': 'cpu',
                              'model': model_path}
        self.ocr_stream = OcrStream(self.name, self.state, self.video_reader, predictor_info)

        self.visualize_stream = VisualizeStream("VisualizeStream", self.video_reader,
                                                self.state, save_path, fps, frame_size, coord, true_text)
        self.logger.info("Start Project")
Beispiel #7
0
    def __init__(self,
                 name,
                 video_path,
                 save_path,
                 fps=60,
                 frame_size=(1280, 720),
                 coord=(500, 500),
                 answer=""):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        # self.ocr_stream = OcrStream(self.state, self.video_reader)
        self.answer = answer

        self.visualize_stream = VisualizeStream("VisualizeStream",
                                                self.video_reader, self.state,
                                                save_path, fps, frame_size,
                                                coord, answer)
        self.logger.info("Start Project")
Beispiel #8
0
class CNDProject:
    def __init__(self, name, video_path, save_path, model_path, use_cuda, true_text, fps=10, frame_size=(1600, 800), coord=(500, 500)):
        self.name = name
        self.logger = logging.getLogger(self.name)
        self.state = State()
        self.video_reader = VideoReader("VideoReader", video_path)
        if use_cuda:
            predictor_info = {'device': 'cuda',
                              'model': model_path}
        else:
            predictor_info = {'device': 'cpu',
                              'model': model_path}
        self.ocr_stream = OcrStream(self.name, self.state, self.video_reader, predictor_info)

        self.visualize_stream = VisualizeStream("VisualizeStream", self.video_reader,
                                                self.state, save_path, fps, frame_size, coord, true_text)
        self.logger.info("Start Project")

    def start(self):
        self.logger.info("Start project act start")
        try:
            self.video_reader.start()
            self.ocr_stream.start()
            self.visualize_stream.start()
            self.state.exit_event.wait()
        except Exception as e:
            self.logger.exception(e)
        finally:
            self.stop()

    def stop(self):
        self.logger.info("Stop Project")

        self.video_reader.stop()
        self.ocr_stream.stop()
        self.visualize_stream.stop()