From 134e373f3a2a8f4fc532b6f8b471bc7e63d154ec Mon Sep 17 00:00:00 2001 From: sumona-banerjeee Date: Wed, 25 Mar 2026 11:18:25 +0530 Subject: [PATCH] gemini --- src/components/video-player-section.tsx | 51 +++++++++++++++---------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/src/components/video-player-section.tsx b/src/components/video-player-section.tsx index 26927d2..b05cb77 100644 --- a/src/components/video-player-section.tsx +++ b/src/components/video-player-section.tsx @@ -92,7 +92,8 @@ export default function VideoPlayerSection({ return data; } - // Synthesize frames from lists if not present (like in gemini_video) + // Synthesize frames from lists if not present (specifically for gemini_video) + // Other models like YOLO return data.frames directly const framesMap = new Map(); // Sort all detections by their first_detected_frame @@ -115,26 +116,36 @@ export default function VideoPlayerSection({ allDetections.forEach(det => { const frameId = det.first_detected_frame || det.frame_number || 0; - if (!framesMap.has(frameId)) { - framesMap.set(frameId, { frame_id: frameId, detections: [] }); + // Spread detection across multiple frames so it stays visible (persistence) + // Gemini detections are sparse, so showing them for ~1 second (30 frames) helps + const persistenceFrames = 30; + + for (let i = 0; i < persistenceFrames; i++) { + const targetFrame = frameId + i; + + if (!framesMap.has(targetFrame)) { + framesMap.set(targetFrame, { frame_id: targetFrame, detections: [] }); + } + + const frameData = framesMap.get(targetFrame); + + // Update cumulative counts only on the first detected frame + if (i === 0) { + const typeConfig = enabledTypes.find(t => t.id === det._detType); + if (typeConfig) { + currentCounts[typeConfig.frameCountKey] = (currentCounts[typeConfig.frameCountKey] || 0) + 1; + } + } + + const countCopy = { ...currentCounts }; + + frameData.detections.push({ + ...det, + type: det.type || det._detType, + detection_id: det.detection_id || det.id, + count: countCopy + }); } - - const frameData = framesMap.get(frameId); - - // Update cumulative counts - const typeConfig = enabledTypes.find(t => t.id === det._detType); - if (typeConfig) { - currentCounts[typeConfig.frameCountKey] = (currentCounts[typeConfig.frameCountKey] || 0) + 1; - } - - const countCopy = { ...currentCounts }; - - frameData.detections.push({ - ...det, - type: det.type || det._detType, - detection_id: det.detection_id || det.id, - count: countCopy - }); }); return {