MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / process_layer_index_data

Function process_layer_index_data

slowfast/visualization/utils.py:278–301  ·  view source on GitHub ↗

Extract layer names and numpy-like fancy indexing from a string. Args: layer_ls (list of strs): list of strings containing data about layer names and their indexing. For each string, layer name and indexing is separated by whitespaces. e.g.: [layer1 1,2;2, la

(layer_ls, layer_name_prefix="")

Source from the content-addressed store, hash-verified

276
277
278def process_layer_index_data(layer_ls, layer_name_prefix=""):
279 """
280 Extract layer names and numpy-like fancy indexing from a string.
281 Args:
282 layer_ls (list of strs): list of strings containing data about layer names
283 and their indexing. For each string, layer name and indexing is separated by whitespaces.
284 e.g.: [layer1 1,2;2, layer2, layer3 150;3,4]
285 layer_name_prefix (Optional[str]): prefix to be added to each layer name.
286 Returns:
287 layer_name (list of strings): a list of layer names.
288 indexing_dict (Python dict): a dictionary of the pair
289 {one_layer_name: indexing_for_that_layer}
290 """
291
292 layer_name, indexing_dict = [], {}
293 for layer in layer_ls:
294 ls = layer.split()
295 name = layer_name_prefix + ls[0]
296 layer_name.append(name)
297 if len(ls) == 2:
298 indexing_dict[name] = get_indexing(ls[1])
299 else:
300 indexing_dict[name] = ()
301 return layer_name, indexing_dict
302
303
304def process_cv2_inputs(frames, cfg):

Callers 1

run_visualizationFunction · 0.90

Calls 1

get_indexingFunction · 0.85

Tested by

no test coverage detected