gemini
This commit is contained in:
@@ -92,7 +92,8 @@ export default function VideoPlayerSection({
|
|||||||
return data;
|
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>();
|
const framesMap = new Map<number, any>();
|
||||||
|
|
||||||
// Sort all detections by their first_detected_frame
|
// Sort all detections by their first_detected_frame
|
||||||
@@ -115,26 +116,36 @@ export default function VideoPlayerSection({
|
|||||||
allDetections.forEach(det => {
|
allDetections.forEach(det => {
|
||||||
const frameId = det.first_detected_frame || det.frame_number || 0;
|
const frameId = det.first_detected_frame || det.frame_number || 0;
|
||||||
|
|
||||||
if (!framesMap.has(frameId)) {
|
// Spread detection across multiple frames so it stays visible (persistence)
|
||||||
framesMap.set(frameId, { frame_id: frameId, detections: [] });
|
// 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 {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user