gemini
This commit is contained in:
@@ -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<number, any>();
|
||||
|
||||
// Sort all detections by their first_detected_frame
|
||||
@@ -115,17 +116,26 @@ 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(frameId);
|
||||
const frameData = framesMap.get(targetFrame);
|
||||
|
||||
// Update cumulative counts
|
||||
// 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 };
|
||||
|
||||
@@ -135,6 +145,7 @@ export default function VideoPlayerSection({
|
||||
detection_id: det.detection_id || det.id,
|
||||
count: countCopy
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user