mPyPl.xmlstream
index
d:\winapp\anaconda3\lib\site-packages\mpypl\xmlstream.py

# mPyPl - Monadic Pipeline Library for Python
http://github.com/shwars/mPyPl

 
Modules
       
enum
xml.etree.ElementTree
json
numpy
os

 
Functions
       
get_pascal_annotations(dir='Annotations', ext='.xml', skip_fields=[])
Return stream of bounding box annotations from Pascal VOC annotation directory
:param dir: Directory where XML files with annotations are, defaults to 'Annotations'
:param ext: Extension, defaults to '.xml'
:param skip_fields: Fields to skip
:return: Datastream
get_xmlstream_from_dir(dir, ext='.xml', list_fields=[], flatten_fields=[], skip_fields=[], populate_aux_fields=False)
Returns the stream of XML objects retrieved from files in the given directory. This can be used, for example, for
reading Pascal VOC annotations.
:param dir: Directory of XML files to use
:param list_fields: fields to be treated as lists (useful is we know that certain values will be present more than once)
:param flatten_fields: fields to be flattened
:param skip_fields: fields to be skipped
:return: A stream of `mdict`s with fields corresponding to XML elements
populate_mdict_from_xml(xml, m, prefix='', list_fields=[], flatten_fields=[], skip_fields=[])
Construct `mdict` object from part of XML tree
:param xml: part of `ElementTree` XML DOM
:param prefix: prefix to use for each field (useful for recursive calls)
:param list_fields: fields to be treated as lists (useful is we know that certain values will be present more than once)
:param flatten_fields: fields to be flattened
:param skip_fields: fields to be skipped
:return: mdict object