Skip to content

Commit 162f71b

Browse files
committed
fix bugs in embeddings input tensor shape and emomusic angle calculation
1 parent 06df6c8 commit 162f71b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/demos/mood-classifiers/src/EffnetEmbeddings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ export default class EffnetMusicnnEmbeddings {
5555
for (let f=0; f < melspectrogram.length; f++) {
5656
const melbandsFrame = melspectrogram[f];
5757
for (let b=0; b < melbandsFrame.length; b++) {
58+
const offset = f * this.numMelBands;
5859
const bandValue = melbandsFrame[b]
59-
flattenedMelspectrogram[f+b] = bandValue;
60+
flattenedMelspectrogram[offset+b] = bandValue;
6061
}
6162
}
6263

examples/demos/mood-classifiers/src/pointToEmoji.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export function pointToEmoji(x, y) {
4141
return img;
4242
}
4343

44-
const angle = 360 + (Math.atan2(y-centerVal, x-centerVal) * 180/Math.PI); // in degrees
44+
let angle = Math.atan2(y-centerVal, x-centerVal) * 180/Math.PI; // in degrees
45+
if (angle < 0) angle += 360;
4546
const clockPos = Math.floor(angle/30);
4647
img.src = emojis[clockPos]
4748
return img;

0 commit comments

Comments
 (0)