This commit is contained in:
Linrador 2026-07-15 13:53:16 +02:00
parent caf3e8b56b
commit 4fae998205
5 changed files with 20 additions and 7 deletions

View File

@ -2673,6 +2673,7 @@ func analyzeVideoFromFramesForGoal(
highlightHits, positionEvidence = applyVideoMAEPositionClipsForAnalyze( highlightHits, positionEvidence = applyVideoMAEPositionClipsForAnalyze(
ctx, ctx,
file,
samples, samples,
durationSec, durationSec,
highlightHits, highlightHits,
@ -2744,6 +2745,7 @@ func analyzeVideoFromFramesForGoal(
highlightHits, positionEvidence = applyVideoMAEPositionClipsForAnalyze( highlightHits, positionEvidence = applyVideoMAEPositionClipsForAnalyze(
ctx, ctx,
file,
samples, samples,
durationSec, durationSec,
highlightHits, highlightHits,

View File

@ -18,8 +18,9 @@ const (
analyzeVideoMAEClipStrideSeconds = 2.0 analyzeVideoMAEClipStrideSeconds = 2.0
analyzeVideoMAEMinScore = 0.34 analyzeVideoMAEMinScore = 0.34
analyzeVideoMAERequestBatchSize = 8 analyzeVideoMAERequestBatchSize = 8
analyzeVideoMAEMaxClips = 180 analyzeVideoMAEMaxClips = 96
analyzeVideoMAERequestTimeout = 75 * time.Second analyzeVideoMAERequestTimeout = 45 * time.Second
analyzeVideoMAETotalTimeout = 2 * time.Minute
) )
type analyzeVideoMAEClipReqItem struct { type analyzeVideoMAEClipReqItem struct {
@ -169,7 +170,7 @@ func predictVideoMAEPositionClipsForAnalyze(
body, err := json.Marshal(payload) body, err := json.Marshal(payload)
if err != nil { if err != nil {
return nil, err return out, err
} }
parsed, err := func() (analyzeVideoMAEClipPredictResp, error) { parsed, err := func() (analyzeVideoMAEClipPredictResp, error) {
@ -231,7 +232,7 @@ func predictVideoMAEPositionClipsForAnalyze(
return parsed, nil return parsed, nil
}() }()
if err != nil { if err != nil {
return nil, err return out, err
} }
if !parsed.Available { if !parsed.Available {
@ -252,6 +253,7 @@ func predictVideoMAEPositionClipsForAnalyze(
func applyVideoMAEPositionClipsForAnalyze( func applyVideoMAEPositionClipsForAnalyze(
ctx context.Context, ctx context.Context,
file string,
samples []videoFrameSample, samples []videoFrameSample,
duration float64, duration float64,
highlightHits []analyzeHit, highlightHits []analyzeHit,
@ -268,7 +270,8 @@ func applyVideoMAEPositionClipsForAnalyze(
} }
if len(clips) > analyzeVideoMAEMaxClips { if len(clips) > analyzeVideoMAEMaxClips {
appLogf( appLogf(
"VideoMAE Clip-Analyse begrenzt: clips=%d max=%d", "VideoMAE Clip-Analyse begrenzt file=%q clips=%d max=%d",
strings.TrimSpace(file),
len(clips), len(clips),
analyzeVideoMAEMaxClips, analyzeVideoMAEMaxClips,
) )
@ -279,15 +282,23 @@ func applyVideoMAEPositionClipsForAnalyze(
onProgress(0, len(clips)) onProgress(0, len(clips))
} }
predictions, err := predictVideoMAEPositionClipsForAnalyze(ctx, clips, onProgress) videoCtx, cancel := context.WithTimeout(ctx, analyzeVideoMAETotalTimeout)
defer cancel()
predictions, err := predictVideoMAEPositionClipsForAnalyze(videoCtx, clips, onProgress)
if err != nil { if err != nil {
if ctx.Err() == nil { if ctx.Err() == nil {
appLogf(
"VideoMAE Clip-Analyse begrenzt/übersprungen file=%q predictions=%d err=%v",
strings.TrimSpace(file),
len(predictions),
err,
)
if onProgress != nil { if onProgress != nil {
onProgress(len(clips), len(clips)) onProgress(len(clips), len(clips))
} }
appLogln("VideoMAE Clip-Analyse übersprungen:", err) appLogln("VideoMAE Clip-Analyse übersprungen:", err)
} }
return highlightHits, positionEvidence
} }
for _, pred := range predictions { for _, pred := range predictions {

BIN
backend/dist/nsfwapp-linux-amd64 vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.