Ensure to copy data to cpu before iterating. (#1360)

This commit is contained in:
Marcus Asteborg
2023-11-22 23:24:25 -08:00
committed by GitHub
parent f83e14f68d
commit ec23427d60
2 changed files with 4 additions and 1 deletions

View File

@ -43,6 +43,7 @@ pub fn report(
confidence_threshold: f32,
nms_threshold: f32,
) -> Result<DynamicImage> {
let pred = pred.to_device(&Device::Cpu)?;
let (npreds, pred_size) = pred.dims2()?;
let nclasses = pred_size - 5;
// The bounding boxes grouped by (maximum) class index.