mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 10:26:33 +00:00
Automatic mask generation (#779)
* A few more contiguous fixes for cuda. * Mask generation. * Generic bbox. * Generate all the masks.
This commit is contained in:
@ -46,7 +46,7 @@ pub fn report(
|
||||
let (npreds, pred_size) = pred.dims2()?;
|
||||
let nclasses = pred_size - 5;
|
||||
// The bounding boxes grouped by (maximum) class index.
|
||||
let mut bboxes: Vec<Vec<Bbox>> = (0..nclasses).map(|_| vec![]).collect();
|
||||
let mut bboxes: Vec<Vec<Bbox<()>>> = (0..nclasses).map(|_| vec![]).collect();
|
||||
// Extract the bounding boxes for which confidence is above the threshold.
|
||||
for index in 0..npreds {
|
||||
let pred = Vec::<f32>::try_from(pred.get(index)?)?;
|
||||
@ -65,7 +65,7 @@ pub fn report(
|
||||
xmax: pred[0] + pred[2] / 2.,
|
||||
ymax: pred[1] + pred[3] / 2.,
|
||||
confidence,
|
||||
keypoints: vec![],
|
||||
data: (),
|
||||
};
|
||||
bboxes[class_index].push(bbox)
|
||||
}
|
||||
|
Reference in New Issue
Block a user