Input Modules - src.runtime.modules.input namespace¶
An input module is responsible to supply frames to the application. To achieve this the module gets the process_frames method passed, which is used by the module to send data to the FrameProcessor. See its documentation for more details on its parameters
The input module will only be called once. As soon as it returns the application will exit. An input module has to be registered in setup_input.
Submodules¶
src.runtime.modules.input.input_images module¶
-
src.runtime.modules.input.input_images.
input_images
(process_frames: Callable[[torch.Tensor, List[str], List[numpy.ndarray]], None], input_file='cfg.data_root/cfg.test_txt', data_root='cfg.data_root')[source]¶ load images frame by frame and passes them to process_frame
used non-basic-cfg values:
test_txt
- Parameters
process_frames – function taking a list of preprocessed frames, file paths and source frames
input_file – index txt file to process
data_root – root directory of dataset
src.runtime.modules.input.input_screencap module¶
-
src.runtime.modules.input.input_screencap.
input_screencap
(process_frames: Callable, mon: dict) → None[source]¶ record from screen batch size is always 1
This is was implemented to test GTA. Its a bit difficult to use. You have to manually specify the position and size of your target window here. If your information are wrong (out of screen) you’ll get a cryptic exception! Make sure your config resolution matches your settings here.
used non-basic cfg options: screencap_enable_image_forwarding
- Parameters
process_frames – function taking a list of preprocessed frames, file paths and source frames
mon – position and size of recording window, eg {‘top’: 0, ‘left’: 3440, ‘width’: 1920, ‘height’: 1080}
src.runtime.modules.input.input_video module¶
-
src.runtime.modules.input.input_video.
input_camera
(process_frames: Callable[[torch.Tensor, List[str], List[numpy.ndarray]], None], camera_number: int = 'cfg.camera_input_cam_number')[source]¶ camera input wrapper for input_video()
used non-basic-cfg values:
camera_input_cam_number
- Parameters
process_frames – function taking a list of preprocessed frames, file paths and source frames
camera_number – opencv camera index
-
src.runtime.modules.input.input_video.
input_video
(process_frames: Callable[[torch.Tensor, List[str], List[numpy.ndarray]], None], input_file: Union[str, int] = 'cfg.video_input_file', names_file: str = None)[source]¶ read a video file or camera stream. batch size is always 1
used non-basic-cfg values:
video_input_file
- Parameters
process_frames – function taking a list of preprocessed frames, file paths and source frames
input_file – video file (path; string) or camera index (integer)
names_file – list with file paths to the frames of the video; if names_file and frames (jpg’s) are available the input images module can also be used