GazeML icon indicating copy to clipboard operation
GazeML copied to clipboard

training in TX2

Open cshreyastech opened this issue 5 years ago • 1 comments

I am trying to train this implementation in TX2.

I made few modifications to webcam.py as below. cv2 recognizes the frames, I tested it out. class WebcamTX2(FramesSource): """Webcam frame grabbing and preprocessing."""

def __init__(self, camera_id=2, fps=120.000000, **kwargs):
    """Create queues and threads to read and preprocess data."""
    self._short_name = 'WebcamTX2'

    self._capture = cv.VideoCapture("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)96/1 ! nvvidconv flip-method=6 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=(string)BGR ! appsink")
    #self._capture = cv.VideoCapture(camera_id)
    #self._capture.set(cv.CAP_PROP_FRAME_WIDTH, 1280)
    #self._capture.set(cv.CAP_PROP_FRAME_HEIGHT, 720)
    #self._capture.set(cv.CAP_PROP_FOURCC, cv.VideoWriter_fourcc(*'MJPG'))
    #self._capture.set(cv.CAP_PROP_FPS, fps)

    # Call parent class constructor
    super().__init__(**kwargs)

def frame_generator(self):
    """Read frame from webcam."""
    if not self._capture.isOpened() :
        print("not capture")
        exit()

    ret,bgr = self._capture.read()
    while True:
        ret, bgr = self._capture.read()
        if ret:
            yield bgr

I run into errors on executing elg_demo.py. Below is the stack trace. Can you please guide me in debugging this?

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1599, in exit self._default_graph_context_manager.exit(exec_type, exec_value, exec_tb) File "/usr/lib/python3.5/contextlib.py", line 77, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 5285, in get_controller yield g File "/usr/lib/python3.5/contextlib.py", line 77, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 5093, in get_controller yield default File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 5285, in get_controller yield g File "/usr/lib/python3.5/contextlib.py", line 77, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/eager/context.py", line 295, in _mode yield File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 5285, in get_controller yield g File "elg_demo.py", line 98, in eye_image_shape=(36, 60)) File "/home/nvidia/GazeML/src/datasources/webcamTX2.py", line 21, in init super().init(**kwargs) File "/home/nvidia/GazeML/src/datasources/frames.py", line 47, in init shuffle=False, staging=staging, **kwargs) File "/home/nvidia/GazeML/src/core/data_source.py", line 105, in init (label, tensor) for label, tensor in zip(labels, self._staging_area.get()) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/variable_scope.py", line 2109, in exit self._current_name_scope.exit(type_arg, value_arg, traceback_arg) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 6017, in exit self._name_scope.exit(type_arg, value_arg, traceback_arg) File "/usr/lib/python3.5/contextlib.py", line 77, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 4141, in name_scope yield "" if new_stack is None else new_stack + "/" File "/home/nvidia/GazeML/src/core/data_source.py", line 59, in init labels, dtypes, shapes = self._determine_dtypes_and_shapes() File "/home/nvidia/GazeML/src/core/data_source.py", line 194, in _determine_dtypes_and_shapes raw_entry = next(self.entry_generator(yield_just_one=True)) File "/home/nvidia/GazeML/src/datasources/frames.py", line 106, in entry_generator self.detect_landmarks(frame) File "/home/nvidia/GazeML/src/datasources/frames.py", line 171, in detect_landmarks predictor = get_landmarks_predictor() File "/home/nvidia/GazeML/src/datasources/frames.py", line 371, in get_landmarks_predictor _landmarks_predictor = dlib.shape_predictor(dat_path) RuntimeError: Error deserializing object of type unsigned long while deserializing object of type std::vector while deserializing object of type std::vector while deserializing object of type std::vector

Thanks for the help. Shreyas

cshreyastech avatar May 31 '19 04:05 cshreyastech

It seems that you have problems with dlib files. Have you checked the dlib pre-trained model file?

Normally it occurs when you did not download the raw file directly.

WuZhuoran avatar Jul 24 '19 23:07 WuZhuoran