MCPcopy Create free account
hub / github.com/MotrixLab/ADHMR / get_max_pred_batch

Function get_max_pred_batch

ADHMR/lib/utils/transforms.py:1313–1333  ·  view source on GitHub ↗
(batch_heatmaps)

Source from the content-addressed store, hash-verified

1311
1312
1313def get_max_pred_batch(batch_heatmaps):
1314 batch_size = batch_heatmaps.shape[0]
1315 num_joints = batch_heatmaps.shape[1]
1316 width = batch_heatmaps.shape[3]
1317 heatmaps_reshaped = batch_heatmaps.reshape((batch_size, num_joints, -1))
1318 idx = np.argmax(heatmaps_reshaped, 2)
1319 maxvals = np.max(heatmaps_reshaped, 2)
1320
1321 maxvals = maxvals.reshape((batch_size, num_joints, 1))
1322 idx = idx.reshape((batch_size, num_joints, 1))
1323
1324 preds = np.tile(idx, (1, 1, 2)).astype(np.float32)
1325
1326 preds[:, :, 0] = (preds[:, :, 0]) % width
1327 preds[:, :, 1] = np.floor((preds[:, :, 1]) / width)
1328
1329 pred_mask = np.tile(np.greater(maxvals, 0.0), (1, 1, 2))
1330 pred_mask = pred_mask.astype(np.float32)
1331
1332 preds *= pred_mask
1333 return preds, maxvals
1334
1335
1336def get_affine_transform(center,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected