Parsing

This submodule contains a collection of helper to parse filenames and some fields in bb_binary repositories to Python datastructures.

There are also some helper to convert some data representations like timeformats or ids.

dt_to_str(dt)[source]
get_fname(camIdx, dt)[source]
get_video_fname(camIdx, begin, end)[source]
get_timezone()[source]
int_id_to_binary(int_id, nb_bits=12)[source]

Helper to convert an id represented as integer to a bit array.

Warning

This function uses big-endian notation whereas DetectionDP uses little-endian notation for decodedId.

Parameters:int_id (int) – the integer id to convert to a bit array
Keyword Arguments:
 nb_bits (Optional int) – number of bits in the bit array
Returns:the bit array in big-endian notation
Return type:np.array
binary_id_to_int(decoded_id, threshold=0.5, endian='big')[source]

Helper to convert an id represented as bit array to an integer.

Warning

DetectionDP uses little-endian notation for decodedId.

Note

This is a generic solution to the problem. If have to decode a lot of ids take a look on numpy.packbits() and implement a vectorized version.

Parameters:

decoded_id (list of int or float) – id as bit array

Keyword Arguments:
 
  • threshold (Optional float) – decoded_id values >= threshold are interpreted as 1
  • endian (Optional str) – use either ‘big’ or ‘little’, default is ‘big’
Returns:

the decoded id represented as integer

Return type:

int

parse_cam_id(fname)[source]
parse_fname(fname)[source]
parse_image_fname_beesbook(fname)[source]
parse_image_fname_iso(fname)[source]
parse_image_fname(fname, format='auto')[source]
parse_video_fname(fname, format='auto')[source]
to_datetime(t)[source]
to_timestamp(dt)[source]