Code Monkey home page Code Monkey logo

Comments (8)

dest4 avatar dest4 commented on June 6, 2024

I have written a MFCC calculation in JS. Still having problems with Tensorflow.JS though, but it's making progress.

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

New branch showing work in progress:
https://github.com/adblockradio/adblockradio/tree/mljs

Still need to validate the calculations.

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

MFCC calculations are now validated. Testing the new algo end to end now.

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

End to end validated on the radio recording (in podcasts/example.mp3), yay!
About 8 minutes of content analyzed on a Core I5-5200U in

  • 58s with the Node + Python version
  • 2min21 with the pure Node version, with native Tensorflow library.

It's a huge discrepancy, but I noticed that the Python calculus is massively parallel while the Node version uses only one core and probably one thread. The test CPU has two cores and 4-theads.
In conclusion, the two approaches seem equivalently efficient.

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

Here is diff of the results log. Differences are only due to rounding errors, most often about the gain.

$ diff example.mp3.keras.json example.mp3.tfjs.json 
2102c2102
< 			"gain": 76.47,
---
> 			"gain": 76.48,
2152c2152
< 			"gain": 76.58,
---
> 			"gain": 76.59,
3056c3056
< 			"gain": 77.17,
---
> 			"gain": 77.18,
3446c3446
< 			"gain": 75.87,
---
> 			"gain": 75.88,
3762c3762
< 			"gain": 74.21,
---
> 			"gain": 74.22,
4229c4229
< 					0.253,
---
> 					0.254,
4260c4260
< 				0.2515,
---
> 				0.252,
4268c4268
< 			"gain": 75.61,
---
> 			"gain": 75.62,
6086c6086
< 			"gain": 78.66,
---
> 			"gain": 78.67,
6376c6376
< 			"gain": 77.96,
---
> 			"gain": 77.97,
7778c7778
< 			"gain": 77.06,
---
> 			"gain": 77.07,
8326c8326
< 			"gain": 75.76,
---
> 			"gain": 75.77,
9662c9662
< 			"gain": 75.6,
---
> 			"gain": 75.61,
10052c10052
< 			"gain": 75.16,
---
> 			"gain": 75.17,
11646c11646
< 			"gain": 74.68,
---
> 			"gain": 74.69,
12020c12020
< 			"gain": 76.3,
---
> 			"gain": 76.31,
12766c12766
< 			"gain": 76.15,
---
> 			"gain": 76.16,
13048c13048
< 			"gain": 76.26,
---
> 			"gain": 76.27,
13570c13570
< 			"gain": 75.49,
---
> 			"gain": 75.5,
14110c14110
< 			"gain": 76.98,
---
> 			"gain": 76.99,
15156c15156
< 			"gain": 75.76,
---
> 			"gain": 75.77,
16974c16974
< 			"gain": 76.2,
---
> 			"gain": 76.21,
17306c17306
< 			"gain": 75.58,
---
> 			"gain": 75.59,
17480c17480
< 			"gain": 76.53,
---
> 			"gain": 76.54,
18078c18078
< 			"gain": 74.76,
---
> 			"gain": 74.77,
18302c18302
< 			"gain": 74.47,
---
> 			"gain": 74.48,
19414c19414
< 			"gain": 74.52,
---
> 			"gain": 74.53,
21024c21024
< 			"gain": 75.5,
---
> 			"gain": 75.51,
21630c21630
< 			"gain": 76.68,
---
> 			"gain": 76.69,
22650c22650
< 			"gain": 76.54,
---
> 			"gain": 76.55,
22708c22708
< 			"gain": 72.23,
---
> 			"gain": 72.24,
23538c23538
< 			"gain": 76.83,
---
> 			"gain": 76.84,
23596c23596
< 			"gain": 74.27,
---
> 			"gain": 74.28,
24110c24110
< 			"gain": 74.58,
---
> 			"gain": 74.59,
24516c24516
< 			"gain": 76.05,
---
> 			"gain": 76.06,
25428c25428
< 			"gain": 75.01,
---
> 			"gain": 75.02,
26521c26521
< 	"analysisTime": 58.593
---
> 	"analysisTime": 141.5

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

On low horse power CPUs, the single thread approach does not work well. I may have to put the computations in a separate thread.

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

I have put the ML computations in a different thread in e5f1340

Now the podcast analysis demo, which did run in 2min21 in the single thread version, runs in 2min.

I had reviewed node-webworker-threads and would have loved to provide a unified codebase for node and browser, but it is not possible to require in webworkers. Another solution will be needed for inference in browsers.

from adblockradio.

dest4 avatar dest4 commented on June 6, 2024

I have merged PR #8

Now computations can be done with Python (default) or with JS+native Tensorflow lib, with pure JS Tensorflow as a fallback.

The JS+native lib performance is underwhelming unfortunately, but it's a nice perspective to have it in order to port Adblock Radio to web browser extensions some day.

from adblockradio.

Related Issues (11)

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.