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

clusteredSegmentation is broken #7

Open
tremblap opened this issue Oct 26, 2020 · 9 comments
Open

clusteredSegmentation is broken #7

tremblap opened this issue Oct 26, 2020 · 9 comments

Comments

@tremblap
Copy link

commit f294596

trying it with a valid file, works for the FluidNoveltySlice but then aborts:

Traceback (most recent call last):
File "clustered_segmentation.py", line 21, in
w.run()
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/world.py", line 109, in run
c.walk_chain()
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/corpus.py", line 47, in walk_chain
forward_connection.walk_chain()
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/common/analyser.py", line 167, in walk_chain
forward_connection.walk_chain()
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/common/analyser.py", line 151, in walk_chain
self.run()
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/analyser/meta.py", line 144, in run
singleproc(self.name, self.analyse, self.input)
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/common/proc.py", line 28, in singleproc
process(x)
File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/analyser/meta.py", line 116, in analyse
mfccs = fluid.mfcc(
File "/Users/pa/anaconda/envs/ftis4dummies/lib/python3.8/site-packages/flucoma/fluid.py", line 469, in mfcc
fftsettings = fftsanitise(fftsettings)
File "/Users/pa/anaconda/envs/ftis4dummies/lib/python3.8/site-packages/flucoma/utils.py", line 15, in fftsanitise
int(fftsettings[2])
IndexError: list index out of range

@jamesb93
Copy link
Owner

Hi PA,

It looks like fftsettings for the mfcc() function are not able to be sanitised because it expects to get 3 values as a list and it cannot index the last value.

Can you post the script here for reference?

@tremblap
Copy link
Author

tremblap commented Oct 26, 2020

This is fun, since I am not changing them at all...

from ftis.world import World
from ftis.corpus import Corpus
from ftis.analyser.meta import ClusteredSegmentation
from ftis.analyser.slicing import FluidNoveltyslice
from ftis.adapter.reaper import render_tracks
from ftis.common.io import get_sr
from pathlib import Path


c = Corpus("/Volumes/machins/projets/newsfeed/sons/textes/Audio/synth/fromtexttospeech-AmE-George.wav")
nov = FluidNoveltyslice(threshold=0.05, minslicelength=1, fftsettings=[1024,128,1024], filtersize=5, kernelsize=29)
# if we dont set the minslicelength to 2 then we might generate slices too short for the analysis 
seg = ClusteredSegmentation()

c >> nov >> seg

w = World(sink="~/Desktop/clustered_segmentation")
w.build(c)

if __name__ == "__main__":
    w.run()

    tracks = {}
    for media, slices in seg.output.items():
        pos = 0
        sr = get_sr(media)
        items = []
        for start, end in zip(slices, slices[1:]):
            start /= sr
            end /= sr

            item = {
                "file" : media,
                "length" : end - start,
                "start" : start,
                "position" : pos
            }

            pos += end - start

            items.append(item)
        
        tracks[media] = items

    render_tracks(
        Path("~/Desktop/clustered_segmentation/clustered_slices.rpp").expanduser(), 
        data = tracks
    )

@jamesb93
Copy link
Owner

Okay, I do remember we edited the FTIS class ClusteredSegmentation() though so could you dig into that class definition and see what the internal MFCC fftsettings are?

@tremblap
Copy link
Author

tremblap commented Oct 26, 2020

I deleted the edits, this is a new env and a new pull. So the internals are as is in the commit:

fftsettings=[1024, -1 -1]

@jamesb93
Copy link
Owner

Gotchya, I shall investigate and report back

@jamesb93
Copy link
Owner

It is a missing comma. Fixed (I think). Can you test? dcd9f1f

@tremblap
Copy link
Author

not working despite the comma, but a new bug:

Traceback (most recent call last):
  File "clustered_segmentation.py", line 21, in <module>
    w.run()
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/world.py", line 109, in run
    c.walk_chain()
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/corpus.py", line 47, in walk_chain
    forward_connection.walk_chain()
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/common/analyser.py", line 167, in walk_chain
    forward_connection.walk_chain()
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/common/analyser.py", line 151, in walk_chain
    self.run()
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/analyser/meta.py", line 144, in run
    singleproc(self.name, self.analyse, self.input)
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/common/proc.py", line 28, in singleproc
    process(x)
  File "/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/ftis/ftis/ftis/analyser/meta.py", line 123, in analyse
    stats = get_buffer(fluid.stats(mfccs, numderivs=self.numderivs), "numpy")
AttributeError: 'ClusteredSegmentation' object has no attribute 'numderivs'

@tremblap
Copy link
Author

but I solved it, line 91

@jamesb93
Copy link
Owner

Okay, thanks. That is also pushed to: 7fe83d1

As you can see these classes are not great for extending 👎 and their interface sucks quite a lot but thanks for sticking with it

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

No branches or pull requests

2 participants