MCPcopy Create free account
hub / github.com/InternRobotics/P3Former / transform

Method transform

datasets/transforms/formating.py:88–121  ·  view source on GitHub ↗

Method to pack the input data. when the value in this dict is a list, it usually is in Augmentations Testing. Args: results (dict | list[dict]): Result dict from the data pipeline. Returns: dict | List[dict]: - 'inputs' (dict): The forwa

(self, results: Union[dict,
                                       List[dict]])

Source from the content-addressed store, hash-verified

86 return key
87
88 def transform(self, results: Union[dict,
89 List[dict]]) -> Union[dict, List[dict]]:
90 """Method to pack the input data. when the value in this dict is a
91 list, it usually is in Augmentations Testing.
92
93 Args:
94 results (dict | list[dict]): Result dict from the data pipeline.
95
96 Returns:
97 dict | List[dict]:
98
99 - 'inputs' (dict): The forward data of models. It usually contains
100 following keys:
101
102 - points
103 - img
104
105 - 'data_samples' (:obj:`Det3DDataSample`): The annotation info of
106 the sample.
107 """
108 # augtest
109 if isinstance(results, list):
110 if len(results) == 1:
111 # simple test
112 return self.pack_single_results(results[0])
113 pack_results = []
114 for single_result in results:
115 pack_results.append(self.pack_single_results(single_result))
116 return pack_results
117 # norm training and simple testing
118 elif isinstance(results, dict):
119 return self.pack_single_results(results)
120 else:
121 raise NotImplementedError
122
123 def pack_single_results(self, results: dict) -> dict:
124 """Method to pack the single input data. when the value in this dict is

Callers

nothing calls this directly

Calls 1

pack_single_resultsMethod · 0.95

Tested by

no test coverage detected