Code Monkey home page Code Monkey logo

Comments (11)

urinieto avatar urinieto commented on July 29, 2024 1

Finally I've implemented this on the 0.1.0-dev branch. It still saves the file, but you can change the path file here (only in single-file mode).

I am planning on having a .msafrc to write all the personal features, where this should be more easily changed (see #23).

Any suggestions/comments? Thanks!

from msaf.

urinieto avatar urinieto commented on July 29, 2024

This can't be disabled at the moment, but it should be easy to include. I might do it later today, thanks for the suggestion. msaf.process() has a list of arguments right now, I will include this new argument there soon.

from msaf.

gnuchoi avatar gnuchoi commented on July 29, 2024

That's great, thank you for such a quick reply and change! I failed to locate msaf.process(), thanks for that as well.

from msaf.

urinieto avatar urinieto commented on July 29, 2024

Ok, if you pull the latest version you should find a new save_json parameter in the arguments of msaf.process.

from msaf.

gnuchoi avatar gnuchoi commented on July 29, 2024

Thank you! I think it's still trying to write a json file though. The message is as below:

  File "main_prepare.py", line 320, in <module>
    boundaries, labels = msaf.process(PATH_ILM_AUDIO + dict_id_path[track_id], boundaries_id="cnmf", labels_id="cnmf", save_json=False)
  File "/homes/kc306/.local/lib/python2.7/site-packages/msaf-0.0.3-py2.7.egg/msaf/run.py", line 350, in process
    all_features)
  File "/homes/kc306/.local/lib/python2.7/site-packages/msaf-0.0.3-py2.7.egg/msaf/featextract.py", line 158, in save_features
    with open(out_file, "w") as f:
IOError: [Errno 13] Permission denied: '/import/c4dm-01/ilm10k-dataset/features/310829-10.01.json'

So I try to fix it by adding an if statement in the run.py, but it says

  File "main_prepare.py", line 320, in <module>
    boundaries, labels = msaf.process(PATH_ILM_AUDIO + dict_id_path[track_id], boundaries_id="cnmf", labels_id="cnmf", save_json=False)
  File "/homes/kc306/.local/lib/python2.7/site-packages/msaf-0.0.3-py2.7.egg/msaf/run.py", line 354, in process
    in_path, annot_beats=annot_beats, framesync=framesync)
  File "/homes/kc306/.local/lib/python2.7/site-packages/msaf-0.0.3-py2.7.egg/msaf/input_output.py", line 226, in get_features
    with open(features_path, "r") as f:

I guess at the moment it first need to save a (at least temporary) json file to store the features, then use it later. Tried to modify by myself, but bit tricky as I don't see the whole structure.

from msaf.

urinieto avatar urinieto commented on July 29, 2024

Yeah, right now it always tries to save a temporary file to store the features (not the estimations). I should look into that, since I can see this can be an issue, but won't be able to do it until next week or so. I will reopen this issue.

from msaf.

keunwoochoi avatar keunwoochoi commented on July 29, 2024

Hi, (I changed my account.)
I tried to modify it by myself (https://github.com/keunwoochoi/msaf/commits/issue14), but now I'm bit stuck in. Basically I'd like to make it run only by using variables in memory without writing any json files.
You can compare 04948cc and 74656e0. The former, also the latest, is one that I added a conversion function in input_output.py to make the form of dictionary usable - but it didn't work as below (1). The latter, the second latest one, is one that almost properly works but the result shows as below (2).

PS. Also I think it would be good to have file existence check in run, i.e. os.path.exists() before line 341 in run.py, it might be done outside of msaf though. When the path is wrong for some reasons (my sshfs got some error so unmounted without telling me anything!), it goes to else, where the path should be one of a directory, then it looks like it falls in a infinite loop. I'd also add this if you think it makes sense.

PS. Actually it is issue15!

(1)

Traceback (most recent call last):
  File "main_prepare.py", line 337, in <module>
    boundaries, labels = msaf.process(PATH_ILM_AUDIO + dict_id_path[track_id], boundaries_id="cnmf", labels_id="cnmf", save_json=False)
  File "/usr/local/lib/python2.7/dist-packages/msaf-0.0.3-py2.7.egg/msaf/run.py", line 360, in process
    framesync=framesync)
  File "/usr/local/lib/python2.7/dist-packages/msaf-0.0.3-py2.7.egg/msaf/input_output.py", line 262, in get_features_from_memory
    beats = np.asarray(feats["beats"]["times"])
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

(2)

Traceback (most recent call last):
  File "main_prepare.py", line 337, in <module>
    boundaries, labels = msaf.process(PATH_ILM_AUDIO + dict_id_path[track_id], boundaries_id="cnmf", labels_id="cnmf", save_json=False)
  File "/usr/local/lib/python2.7/dist-packages/msaf-0.0.3-py2.7.egg/msaf/run.py", line 363, in process
    annotator_id=annotator_id)
  File "/usr/local/lib/python2.7/dist-packages/msaf-0.0.3-py2.7.egg/msaf/run.py", line 185, in run_algorithms_from_memory
    frame_times, config, annotator_id)
  File "/usr/local/lib/python2.7/dist-packages/msaf-0.0.3-py2.7.egg/msaf/run.py", line 156, in run_flat
    features["anal"]["dur"])
  File "/usr/local/lib/python2.7/dist-packages/msaf-0.0.3-py2.7.egg/msaf/utils.py", line 226, in process_segmentation_level
    est_times = np.concatenate(([0], frame_times[est_idxs], [dur]))
IndexError: index 276 is out of bounds for axis 1 with size 264

from msaf.

keunwoochoi avatar keunwoochoi commented on July 29, 2024

If it would take more time to change the structure, how about adding a argument for temp_path that is only used for storing those json files?
I actually did a very straightforward and non-clever workaround - by copying the data I'm using to my local folder, so it is not urgent at all, but still interested in how it would be modified.

from msaf.

urinieto avatar urinieto commented on July 29, 2024

Thanks for doing all of this. Unfortunately don't have time right now to dig into this, since it would require a bit of a change (as you have experienced...).

If it would take more time to change the structure, how about adding a argument for temp_path that is only used for storing those json files?

I would rather have a good solution right away instead of adding extra hacks. Maybe this could go into a different branch though.

from msaf.

keunwoochoi avatar keunwoochoi commented on July 29, 2024

I see. Thanks!

from msaf.

urinieto avatar urinieto commented on July 29, 2024

Closing this, it is done.

from msaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.