(
batch,
classifier_dropout=0.1,
use_text=False,
use_semantic=False,
train_depth=True,
train_reflectance=True,
lidar_utils=None,
text_name="text_aim"
)
| 226 | return colors |
| 227 | |
| 228 | def preprocess( |
| 229 | batch, |
| 230 | classifier_dropout=0.1, |
| 231 | use_text=False, |
| 232 | use_semantic=False, |
| 233 | train_depth=True, |
| 234 | train_reflectance=True, |
| 235 | lidar_utils=None, |
| 236 | text_name="text_aim" |
| 237 | ): |
| 238 | x = [] |
| 239 | if train_depth: |
| 240 | x += [lidar_utils.convert_depth(batch["depth"])] |
| 241 | if train_reflectance: |
| 242 | x += [batch["reflectance"]] |
| 243 | x = torch.cat(x, dim=1) |
| 244 | x = lidar_utils.normalize(x) |
| 245 | x = F.interpolate( |
| 246 | x.to("cuda"), |
| 247 | size=lidar_utils.resolution, |
| 248 | mode="nearest-exact", |
| 249 | ) |
| 250 | |
| 251 | new_texts = None |
| 252 | texts = None |
| 253 | if (use_text): |
| 254 | texts = batch[text_name] |
| 255 | new_texts = [] |
| 256 | for text in texts: |
| 257 | if random.random() < classifier_dropout: |
| 258 | new_texts.append("") |
| 259 | else: |
| 260 | new_texts.append(text) |
| 261 | |
| 262 | semantic = None |
| 263 | if (use_semantic): |
| 264 | semantic = batch["semantic"] |
| 265 | if(not semantic.is_cuda): |
| 266 | semantic = semantic.cuda() |
| 267 | |
| 268 | xyz = None |
| 269 | if("xyz" in batch.keys()): |
| 270 | xyz = batch["xyz"] |
| 271 | if(not xyz.is_cuda): |
| 272 | xyz = xyz.cuda() |
| 273 | |
| 274 | points = None |
| 275 | if("points" in batch.keys()): |
| 276 | points = batch["points"] |
| 277 | if(not points.is_cuda): |
| 278 | points = points.cuda() |
| 279 | |
| 280 | batches = None |
| 281 | if("batch" in batch.keys()): |
| 282 | batches = batch["batch"] |
| 283 | if(not batches.is_cuda): |
| 284 | batches = batches.cuda() |
| 285 |
nothing calls this directly
no test coverage detected