dataeval.utils.metadata.merge ============================= .. py:function:: dataeval.utils.metadata.merge(metadata, ignore_lists = False, fully_qualified = False, as_numpy = False) Merges a collection of metadata dictionaries into a single flattened dictionary of keys and values. Nested dictionaries are flattened, and lists are expanded. Nested lists are dropped as the expanding into multiple hierarchical trees is not supported. :param metadata: Iterable collection of metadata dictionaries to flatten and merge :type metadata: Iterable[Mapping[str, Any]] :param ignore_lists: Option to skip expanding lists within metadata :type ignore_lists: bool, default False :param fully_qualified: Option to return dictionary keys full qualified instead of minimized :type fully_qualified: bool, default False :param as_numpy: Option to return results as lists or NumPy arrays :type as_numpy: bool, default False :returns: * *dict[str, list[Any]] or dict[str, NDArray[Any]]* -- A single dictionary containing the flattened data as lists or NumPy arrays * *NDArray[np.int_]* -- Array defining where individual images start, helpful when working with object detection metadata .. note:: Nested lists of values and inconsistent keys are dropped in the merged metadata dictionary .. rubric:: Example >>> list_metadata = [{"common": 1, "target": [{"a": 1, "b": 3, "c": 5}, {"a": 2, "b": 4}], "source": "example"}] >>> reorganized_metadata, image_indicies = merge(list_metadata) >>> reorganized_metadata {'common': [1, 1], 'a': [1, 2], 'b': [3, 4], 'source': ['example', 'example']} >>> image_indicies array([0])