1- # -*- coding: utf-8 -*-
2- # @Author: Spencer H
3- # @Date: 2022-08-08
4- # @Last Modified by: Spencer H
5- # @Last Modified date: 2022-09-29
6- # @Description:
7- """
8-
9- """
101import glob
112import os
123import re
@@ -156,10 +147,10 @@ def frames(self):
156147 """Wrapper to the classmethod using the split path"""
157148 return self ._get_frames_folder (self .split_path )
158149
159- def _load_frames (self , sensor : str ):
150+ def _load_frames (self , ** kwargs ):
160151 return self .frames
161152
162- def _load_ego (self , frame ):
153+ def _load_ego (self , frame : int , ** kwargs ):
163154 """Ego origin is defined as the center of the vehicle"""
164155 reference = self ._load_ego_reference (frame )
165156 ego = VehicleState ("car" )
@@ -215,7 +206,7 @@ def write_calibration(calib_dict, path, idx):
215206 def _load_ego_reference (self , frame ):
216207 return GlobalOrigin3D # TODO: this is not ideal...
217208
218- def _load_calibration (self , frame , sensor , ego_reference ):
209+ def _load_calibration (self , frame : int , sensor : str , ego_reference , ** kwargs ):
219210 calib_fname = os .path .join (
220211 self .split_path , self .folder_names ["calibration" ], "%06d.txt" % frame
221212 )
@@ -277,7 +268,7 @@ def _load_calibration_from_file(
277268 raise NotImplementedError (sensor )
278269 return calib
279270
280- def _load_image (self , frame , sensor ):
271+ def _load_image (self , frame : int , sensor : str , ** kwargs ):
281272 if isinstance (sensor , str ) and "image" in sensor :
282273 img_fname = os .path .join (
283274 self .split_path , self .folder_names [sensor ], "%06d.png" % frame
@@ -290,8 +281,7 @@ def _load_image(self, frame, sensor):
290281 )
291282 return imread (img_fname )
292283
293- def _load_lidar (self , frame , sensor , ** kwargs ):
294- filter_front = True # always filter KITTI to front-only
284+ def _load_lidar (self , frame : int , filter_front = True , ** kwargs ):
295285 lidar_fname = os .path .join (
296286 self .split_path , self .folder_names ["lidar" ], "%06d.bin" % frame
297287 )
@@ -309,6 +299,7 @@ def _load_objects(
309299 sensor = "image-2" ,
310300 whitelist_types = ["Car" , "Pedestrian" , "Cyclist" ],
311301 ignore_types = ["DontCare" ],
302+ ** kwargs ,
312303 ):
313304 label_fname = os .path .join (
314305 self .split_path , self .folder_names ["label" ], "%06d.txt" % frame
@@ -321,7 +312,7 @@ def _load_objects(
321312 obj .change_reference (object_calib .reference , inplace = True )
322313 return objects
323314
324- def _load_timestamp (self , frame , utime = False , sensor = "lidar" ):
315+ def _load_timestamp (self , frame : int , sensor : str = "lidar" , ** kwargs ):
325316 if os .path .exists (
326317 os .path .join (self .split_path , self .folder_names ["timestamps" ])
327318 ):
@@ -349,7 +340,7 @@ def _save_objects(self, frame, objects, folder, file):
349340 for line in str_list :
350341 f .write (f"{ line } \n " )
351342
352- def _get_sensor_file_name (self , frame , sensor : str ):
343+ def _get_sensor_file_name (self , frame : int , sensor : str ):
353344 return os .path .join (
354345 self .split_path ,
355346 self .folder_names [sensor ],
0 commit comments