MCPcopy Create free account
hub / github.com/Tencent/ObjectDetection-OneStageDet / deserialize

Method deserialize

brambox/boxes/box.py:116–138  ·  view source on GitHub ↗

Deserialization function that can be overloaded in the derived class. The default deserialize will create new ``box_type`` objects and call the deserialize function of these objects with every line of the input string. Args: string (string): Input string to deserialize

(self, string)

Source from the content-addressed store, hash-verified

114 return result
115
116 def deserialize(self, string):
117 """ Deserialization function that can be overloaded in the derived class.
118 The default deserialize will create new ``box_type`` objects and call the deserialize function of these objects with every line of the input string.
119
120 Args:
121 string (string): Input string to deserialize
122
123 Returns:
124 box: Bounding box objects
125
126 Note:
127 The format of the box return value depends on the type of parser. |br|
128 If it is a :any:`brambox.boxes.box.ParserType.SINGLE_FILE`, the return value should be a dictionary ``{"image_id": [box, box, ...], ...}``. |br|
129 If it is a :any:`brambox.boxes.box.ParserType.MULTI_FILE`, the return value should be a list ``[box, box, ...]``.
130 """
131 if self.parser_type != ParserType.MULTI_FILE:
132 raise TypeError('The default implementation of deserialize only works with MULTI_FILE')
133
134 result = []
135 for line in string.splitlines():
136 result += [self.box_type.create(line)]
137
138 return result

Callers

nothing calls this directly

Calls 1

createMethod · 0.45

Tested by

no test coverage detected