Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control scene classification with T command line args #2686

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

cyberj0g
Copy link
Contributor

@cyberj0g cyberj0g commented Dec 9, 2022

  1. Add -detectionSampleRate parameter to control non-stream specific scene classification on T
  2. Log scene classification results on B, even if not requested for the stream
  3. Minor refactoring and cleanup

if len(res.Detections) > 0 {
for _, detection := range res.Detections {
switch x := detection.Value.(type) {
case *net.DetectData_SceneClassification:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth logging in a default case to catch other cases?

actualProfile.(*ffmpeg.SceneClassificationProfile).Classes = DetectorProfile.(*ffmpeg.SceneClassificationProfile).Classes
}
}
if actualProfile != nil && actualProfile.(*ffmpeg.SceneClassificationProfile).SampleRate < math.MaxUint32 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for comparison to MaxUint32 rather than having it be zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That value ends up in something like select=not(mod(Nframe, SampleRate)) in Ffmpeg filter, so we don't want to have 0 here. Hence, MAX as default value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Gotcha

actualProfile := DetectorProfile
if aiEnabled {
presetSampleRate := DetectorProfile.(*ffmpeg.SceneClassificationProfile).SampleRate
if md.DetectorEnabled && len(md.DetectorProfiles) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where there can be more than one DetectorProfiles?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these structures were designed with an aim to have multiple AI capabilities some day.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep for sure, I was more checking that there was no chance we'd unintentionally hit md.DetectorEnabled && len(md.DetectorProfiles) > 1 at some point

Copy link
Contributor

@thomshutt thomshutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good, left a few questions that were more for my understanding than problems with the PR

@codecov
Copy link

codecov bot commented Dec 13, 2022

Codecov Report

Merging #2686 (caf633f) into master (7ea2d42) will increase coverage by 0.02836%.
The diff coverage is 23.21429%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #2686         +/-   ##
===================================================
+ Coverage   56.33537%   56.36373%   +0.02836%     
===================================================
  Files             88          88                 
  Lines          19107       19124         +17     
===================================================
+ Hits           10764       10779         +15     
+ Misses          7758        7757          -1     
- Partials         585         588          +3     
Impacted Files Coverage Δ
cmd/livepeer/starter/starter.go 2.85714% <0.00000%> (-0.01856%) ⬇️
server/broadcast.go 78.07986% <7.14286%> (-0.65084%) ⬇️
core/transcoder.go 34.45596% <25.00000%> (+2.23090%) ⬆️
core/lb.go 79.41176% <60.00000%> (+0.36984%) ⬆️
cmd/livepeer/livepeer.go 47.59358% <100.00000%> (+0.28175%) ⬆️
discovery/db_discovery.go 70.75812% <0.00000%> (+1.08303%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ea2d42...caf633f. Read the comment docs.

Impacted Files Coverage Δ
cmd/livepeer/starter/starter.go 2.85714% <0.00000%> (-0.01856%) ⬇️
server/broadcast.go 78.07986% <7.14286%> (-0.65084%) ⬇️
core/transcoder.go 34.45596% <25.00000%> (+2.23090%) ⬆️
core/lb.go 79.41176% <60.00000%> (+0.36984%) ⬆️
cmd/livepeer/livepeer.go 47.59358% <100.00000%> (+0.28175%) ⬆️
discovery/db_discovery.go 70.75812% <0.00000%> (+1.08303%) ⬆️

@cyberj0g cyberj0g merged commit 1115630 into master Dec 13, 2022
@thomshutt thomshutt mentioned this pull request Dec 21, 2022
@hjpotter92 hjpotter92 deleted the ip/scene-detect-args branch May 2, 2023 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants