Rob Hallam
8a5916192a
test: add negative test to TestLoudAudioFEFunctional
Video file with silent audio (generated with sox) -- should produce no features
since "-inf" are filtered by the FE
2 kuukautta sitten
Rob Hallam
192c952c2d
test: add TestLoudAudioFEFunctional
Functional tests for LoudAudioFeatureExtractor
Currently uses one manually-generated video with blank audio except between
15-20s where 1-2 sine tones are present
2 kuukautta sitten
Rob Hallam
428032d841
test: add FEFunctionalTest base class for FE tests
Only has a single property at present: SAMPLE_DIR for the path to where
sample videos are stored
TestVideoActivityFEFunctional now inherits from this instead of unittest.TestCase
2 kuukautta sitten
Rob Hallam
2e45486372
test: add TestVideoActivityFEFunctional
Tests VAFE using a manually-created 30 seconds video with activity between
15 and 20 seconds.
Relatively quick!
2 kuukautta sitten
Rob Hallam
0d2096aed6
refactor!: rename video_producers → producers
Since it no longer simply produces videos this name is preferred
Also update tests to use updated module name
3 kuukautta sitten
Rob Hallam
445efac7f3
test: [producers] add test_produce() functionality
Uses unittest.mock.path to patch out call to matplotlib.pyplot.savefig()
TODO: better, more-granular tests of the bits of functionality here
3 kuukautta sitten
Rob Hallam
ff09cd4b8f
test: [mocks] add attrs to MockFeature + MockSource.duration()
3 kuukautta sitten
Rob Hallam
649fcae070
test: expand TestFfmpegVideoProducer coverage
mocks out calls to ffmpeg for obvious reasons
3 kuukautta sitten
Rob Hallam
0d2179d445
refactor+fix: extract calls to run, fix args
Extract method _run_no_output for two calls to ffmpeg
Fix feature.path → feature.source.path after Feature API change
3 kuukautta sitten
Rob Hallam
3dc2a5c858
test: add mocks module for commonly-mocked objects
Includes:
- MockInterval
- MockFeature
- MockSource
3 kuukautta sitten
Rob Hallam
6cb0d723ac
test: [utils] add TestFeature fixtures
Gets utils coverage up to 100% (for now)
3 kuukautta sitten
Rob Hallam
7ca0720be2
test: add Interval.test_eq method
@see : 0a08af4
3 kuukautta sitten
Rob Hallam
0a08af4972
test: add MockSource & MockInterval to test Feature
3 kuukautta sitten
Rob Hallam
eaafb43a35
fix: update Feature.__repr__ & add __eq__
Problems fixed:
- Feature repr did not include feature_extractor since that API was changed
- Intervals that were equivalent were not equal, so Features were not properly
sorted or equal
3 kuukautta sitten
Rob Hallam
1bd176848a
test [utils] add Interval tests
Covers:
- to_json
- move_end
- update_duration
- unhappy path exceptions (mostly init)
3 kuukautta sitten
Rob Hallam
35d25c6ff2
test: [utils] add TestSource.test_to_json
3 kuukautta sitten
Rob Hallam
33ccffaead
test: add TestLAFE.t_extract_mocked_get)loudnesses()
Gets test coverage for this module to 100%! (for now)
3 kuukautta sitten
Rob Hallam
fa75059c2d
refactor: extract to method LAFE._get_loudnesses()
This was done so the collection of loudnesses from an audio file could be mocked
in testing, but improves readability
TODO: review number of params and consider further refactoring
3 kuukautta sitten
Rob Hallam
e3b9862bcf
test: add TestFfmpegVideoProducer
3 kuukautta sitten
Rob Hallam
48ead78c9a
test: add TestJSONP & TestVisualisationP
3 kuukautta sitten
Rob Hallam
5993289d7d
test: add move_end method for overlap testing
3 kuukautta sitten
Rob Hallam
fb8f3270e5
test: add mocked loudnorm to TestLAFE
3 kuukautta sitten
Rob Hallam
028adbc640
test: add TestJSONFE with mocks
3 kuukautta sitten
Rob Hallam
bee133d53f
test: Add mocked test calls to TestLFE
3 kuukautta sitten
Rob Hallam
4eaddf9db2
test: add TestVAFE
3 kuukautta sitten
Rob Hallam
d38d5e619f
test: add LAFE - no input files & test_extract()
3 kuukautta sitten
Rob Hallam
9bdd90c4c0
test: add TestLAFE
TestLoudAudioFeatureExtractor -- init only
3 kuukautta sitten
Rob Hallam
28e33ed47a
test: add TestSourceMedia & RFE.test_no_input
TestSourceMedia is a mockinobject so
TODO: rename
3 kuukautta sitten
Rob Hallam
cd8d57e9b1
test: add tests for LAFE and RFE
Initialset of tests for LaughterFeatureExtractor and
RandomFeatureExtractor
3 kuukautta sitten
Rob Hallam
8d188cab19
feat: add JSONEncoder class
Handles serialisation of custom classes via to_json() method if present
3 kuukautta sitten
Rob Hallam
4ecc95174e
feat: add JSONProducer
Outputs a representation of the Features extrated by the pipeline
Intent is to write a FE that takes the output so that a pipeline can be
're-run'
Output JSON could also be used with external tools
3 kuukautta sitten
Rob Hallam
c213f05f9d
feat: improve appearance of visualisations
Annotate features, label axes
3 kuukautta sitten
Rob Hallam
214f8c974a
feat: add VisualisationProducer
Creates a plot showing where in source video(s) the pipeline features
came from
3 kuukautta sitten
Rob Hallam
1acab16541
feat: add Producer superclass above VideoProducer
This pvaes the way for parts of the pipeline that do not produce videos,
such as JSON, images, clips etc
TODO: rename module video_producers → producers
3 kuukautta sitten
Rob Hallam
07083086a0
refactor: pull out _run_get_output() FE method
Runs a command returns stout as string, defined to aid testing
3 kuukautta sitten
Rob Hallam
2a3973091b
refactor: change pass → docstring for tests
3 kuukautta sitten
Rob Hallam
778483837c
refactor: pull out _read_json_from_file()
facilitates test mocking
3 kuukautta sitten
Rob Hallam
c76d9f6264
feat: add JSONFeatureExtractor
Parses JSON, eg that output by the pipeline or defined manually and
produces Features that can be (re-)used with the pipeline
3 kuukautta sitten
Rob Hallam
01369f760e
refactor: fix path/source/feature_extractor
3 kuukautta sitten
Rob Hallam
54257f80aa
feat: add _nonoverlap_mean()
Take the mean of non-overlapping windows of scores
Input: list of tuples in the format (time, score)
Output: list of tuples in the format (time, mean_score)
(reduced set)
3 kuukautta sitten
Rob Hallam
5854f49908
feat: add _drop_lowest() to VAFE
Drops lowest n% (default:33%) of scdet scores, since it scores every
frame
Python being what it is, this could be a single line in another method
but pulling it out into another function:
- makes explicit what we are doing and lets us document why
- makes for easier testing
3 kuukautta sitten
Rob Hallam
b7024717d5
feat: add VAFE functionality
Uses ffmpeg's scdet under the hood apropos of recommendation on
ffmpeg-user ML [1]
[1]: https://ffmpeg.org/pipermail/ffmpeg-user/2024-August/058535.html
3 kuukautta sitten
Rob Hallam
b50b81a899
feat: add LAFE functionality
Uses pyloudnorm under the hood to determine the loudness of the supplied
media file (handles videos transparently)
TBC: some sort of limiter on the number produced
3 kuukautta sitten
Rob Hallam
27175163fc
feat: add VideoActivityFeatureExtractor stub
TBC
3 kuukautta sitten
Rob Hallam
97ea344d8e
feat: add LoudAudioFeatureExtractor stub
TBC
3 kuukautta sitten
Rob Hallam
0c535e1c9d
feat: [OverlapConsolidator] add optional delta
This adds functionality that permits nearby Features to be considered
overlapping, in addition to Features which actual overlap
@see utils.py::Feature
3 kuukautta sitten
Rob Hallam
6c3ffd134e
refactor!: Feature instance variables (source)
BREAKING CHANGE: source now refers to a Source object, the FE that
created the Feature is now referred to by feature_extractor; path is
dropped
This should be more consistent, plus we needed a reference to the
original Source kept around anyway -- path worked but a Source object is
more consistent and explicit about intent
3 kuukautta sitten
Rob Hallam
6b83118b91
feat: add to_json() to Source, Interval & Feature
This lets us serialise properly
3 kuukautta sitten
Rob Hallam
67f181071f
feat: round duration by DEFAULT_PRECISION
associated TODO: make precision configurable
3 kuukautta sitten
Rob Hallam
246aefd34c
feat: add RandomFeatureExtractor
Simple feature extractor that picks random times, used to exercise other
parts of the pipeline
4 kuukautta sitten