| 165 | } |
| 166 | |
| 167 | void Segmentation::_makeTensor(std::vector<std::vector<float>>& projected_data, std::vector<float>& tensor, std::vector<size_t>& invalid_idxs){ |
| 168 | // TODO LOAD THIS TOO |
| 169 | std::vector<float> _img_means = {12.97}; |
| 170 | std::vector<float> _img_stds = {12.35}; |
| 171 | // arkansas |
| 172 | // std::vector<float> _img_means = {12.97, -0.21, -0.13, 0.26, 942.62}; |
| 173 | // std::vector<float> _img_stds = {12.35, 12.04, 12.95, 2.86, 1041.79}; |
| 174 | // kitti |
| 175 | // std::vector<float> _img_means = {12.12, 10.88, 0.23, -1.04, 0.21}; |
| 176 | // std::vector<float> _img_stds = {12.32, 11.47, 6.91, 0.86, 0.16}; |
| 177 | |
| 178 | int channel_offset = _img_h * _img_w; |
| 179 | bool all_zeros = false; |
| 180 | |
| 181 | for (uint32_t pixel_id = 0; pixel_id < projected_data.size(); pixel_id++){ |
| 182 | // check if the pixel is invalid |
| 183 | all_zeros = std::all_of(projected_data[pixel_id].begin(), projected_data[pixel_id].end(), [](int i) { return ((i==0.0f) || (isnan(i))); }); |
| 184 | if (all_zeros) { |
| 185 | invalid_idxs.push_back(pixel_id); |
| 186 | } |
| 187 | for (int i = 0; i < _img_d; i++) { |
| 188 | // normalize the data |
| 189 | if (!all_zeros) { |
| 190 | projected_data[pixel_id][i] = (projected_data[pixel_id][i] - _img_means[i]) / _img_stds[i]; |
| 191 | } |
| 192 | |
| 193 | int buffer_idx = channel_offset * i + pixel_id; |
| 194 | // ((float*)_hostBuffers[_inBindIdx])[buffer_idx] = projected_data[pixel_id][i]; |
| 195 | tensor[buffer_idx] = projected_data[pixel_id][i]; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | void Segmentation::_destaggerCloud(const Cloud::Ptr cloud, Cloud::Ptr& outCloud){ |
| 201 | bool col_valid = true; |
nothing calls this directly
no outgoing calls
no test coverage detected