Quazim0t0 commited on
Commit
457f6cc
·
verified ·
1 Parent(s): b8eec54

Upload 51 files

Browse files
src/components/MultiSourceCaptioningView.tsx CHANGED
@@ -350,18 +350,20 @@ export default function MultiSourceCaptioningView() {
350
  if (boxHistory.length > 0) {
351
  const scaleX = canvas.width / overlayVideo.videoWidth;
352
  const scaleY = canvas.height / overlayVideo.videoHeight;
353
- // Flatten and denormalize all boxes
354
  const denormalizedBoxes: any[] = [];
355
  for (const b of boxHistory) {
356
- if (Array.isArray(b.bbox_2d[0])) {
357
  // Multiple boxes per label
358
  for (const arr of b.bbox_2d) {
359
- denormalizedBoxes.push({
360
- ...b,
361
- bbox_2d: denormalizeBox(arr, canvas.width, canvas.height)
362
- });
 
 
363
  }
364
- } else {
365
  // Single box
366
  denormalizedBoxes.push({
367
  ...b,
 
350
  if (boxHistory.length > 0) {
351
  const scaleX = canvas.width / overlayVideo.videoWidth;
352
  const scaleY = canvas.height / overlayVideo.videoHeight;
353
+ // Fix: Draw all boxes, even if bbox_2d is an array of arrays
354
  const denormalizedBoxes: any[] = [];
355
  for (const b of boxHistory) {
356
+ if (Array.isArray(b.bbox_2d) && Array.isArray(b.bbox_2d[0])) {
357
  // Multiple boxes per label
358
  for (const arr of b.bbox_2d) {
359
+ if (Array.isArray(arr) && arr.length === 4) {
360
+ denormalizedBoxes.push({
361
+ ...b,
362
+ bbox_2d: denormalizeBox(arr, canvas.width, canvas.height)
363
+ });
364
+ }
365
  }
366
+ } else if (Array.isArray(b.bbox_2d) && b.bbox_2d.length === 4) {
367
  // Single box
368
  denormalizedBoxes.push({
369
  ...b,