Borrowed from SRNN code. Reads a csv file and returns a float32 matrix. https://github.com/asheshjain399/RNNexp/blob/srnn/structural_rnn/CRFProblems/H3.6m/generateMotionData.py#L12 Args normalizedData: nxd matrix with normalized data data_mean: vector of mean used to normalize t
(normalizedData, data_mean, data_std, dimensions_to_ignore, actions, one_hot)
| 126 | |
| 127 | |
| 128 | def unNormalizeData(normalizedData, data_mean, data_std, dimensions_to_ignore, actions, one_hot): |
| 129 | """Borrowed from SRNN code. Reads a csv file and returns a float32 matrix. |
| 130 | https://github.com/asheshjain399/RNNexp/blob/srnn/structural_rnn/CRFProblems/H3.6m/generateMotionData.py#L12 |
| 131 | |
| 132 | Args |
| 133 | normalizedData: nxd matrix with normalized data |
| 134 | data_mean: vector of mean used to normalize the data |
| 135 | data_std: vector of standard deviation used to normalize the data |
| 136 | dimensions_to_ignore: vector with dimensions not used by the model |
| 137 | actions: list of strings with the encoded actions |
| 138 | one_hot: whether the data comes with one-hot encoding |
| 139 | Returns |
| 140 | origData: data originally used to |
| 141 | """ |
| 142 | T = normalizedData.shape[0] |
| 143 | D = data_mean.shape[0] |
| 144 | |
| 145 | origData = np.zeros((T, D), dtype=np.float32) |
| 146 | dimensions_to_use = [] |
| 147 | for i in range(D): |
| 148 | if i in dimensions_to_ignore: |
| 149 | continue |
| 150 | dimensions_to_use.append(i) |
| 151 | dimensions_to_use = np.array(dimensions_to_use) |
| 152 | |
| 153 | if one_hot: |
| 154 | origData[:, dimensions_to_use] = normalizedData[:, :-len(actions)] |
| 155 | else: |
| 156 | origData[:, dimensions_to_use] = normalizedData |
| 157 | |
| 158 | # potentially ineficient, but only done once per experiment |
| 159 | stdMat = data_std.reshape((1, D)) |
| 160 | stdMat = np.repeat(stdMat, T, axis=0) |
| 161 | meanMat = data_mean.reshape((1, D)) |
| 162 | meanMat = np.repeat(meanMat, T, axis=0) |
| 163 | origData = np.multiply(origData, stdMat) + meanMat |
| 164 | return origData |
| 165 | |
| 166 | |
| 167 | def revert_output_format(poses, data_mean, data_std, dim_to_ignore, actions, one_hot): |
no outgoing calls
no test coverage detected