diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..af5db2ad --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +* @ZeyadOsama +* @omaraziz255 +* @marwan-elsafty +* @rewanmaklad \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..fc44132a --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# How-to contribute + +Those are the main contributing guidelines for contributing to this project: + +- Verify that your contribution does not embark proprietary code or infringe any copyright of any sort. +- Avoid adding any unnecessary dependencies to the project, especially of those are not easily packaged and installed through `brew` or `apt-get`. +- Use [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) mechanism and please be patient while waiting for reviews. +- Remain polite and civil in all exchanges with the maintainers and other contributors. +- Any issue submitted which does not respect provided template, or lack of information, will be considered as invalid and automatically closed. + +## Get started + +In order to contribute, the safest is to create your [own fork of Apollo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) first. The following set of commands will clone this new repository, create a virtual environment provisioned with the dependencies and run the tests (will take a few minutes): + +```bash +git clone https://github.com//apollo && cd apollo +``` + +You can then make your changes and experiment freely. Once you're done, remember to check that the tests still run. If you've added a new feature, add tests! + +Then finally, you're more than welcome to create a [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) in **Apollo** main repo. We will look at it as soon as possible and eventually integrate your changes in the project. diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 00000000..80b21420 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,49 @@ +--- +NAME: Bug +ABOUT: Report a bug +LABELS: bug, invalid +TITLE: "[Bug] name your bug" +--- + + + +- [ ] I didn't find a similar issue already open. +- [ ] I read the documentation (README & Wiki) +- [ ] My problem is related to Apollo only, not a derivative product (such as CMake, or GUI provided by others) + + +## Description + + + +## Step to reproduce + + + +1. Installed using `...` +2. Run as `...` +3. Got `...` error + +## Output + +```bash +Share what your terminal says when you run the script (as well as what you would expect). +``` + +## Environment + + + +| | | +| ----------------- | ------------------------------- | +| OS | Windows / Linux / MacOS / other | +| Installation type | Conda / pip / other | +| RAM available | XGo | +| Hardware spec | GPU / CPU / etc ... | + +## Additional context + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..3ba13e0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/discussion.md b/.github/ISSUE_TEMPLATE/discussion.md new file mode 100644 index 00000000..11327b2a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/discussion.md @@ -0,0 +1,8 @@ +--- +NAME: Discussion +ABOUT: Ideas sharing or theoretical question solving +LABELS: Question +TITLE: "[Discussion] your question" +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 00000000..52243522 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,14 @@ +--- +NAME: Feature request +ABOUT: Submit idea for new feature +LABELS: feature, enhancement +TITLE: "[Feature] your feature name" +--- + +## Description + + + +## Additional information + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..0f84d72a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +# [Apollo-vX.Y.Z] - + +## Description + +A few sentences describing the overall goals of the pull request's commits. + +## How this patch was tested + +You tested it, right? + +## Documentation link and external references + +Please provide any info that may help us better understand your code. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c61b3bfa..cde25d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ 3.6, 3.7, 3.8 ] + python-version: [ 3.7 ] steps: - uses: actions/checkout@v2 @@ -30,5 +30,4 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest - + pytest \ No newline at end of file diff --git a/.gitignore b/.gitignore index 344b7c27..b8a8cc36 100644 --- a/.gitignore +++ b/.gitignore @@ -314,4 +314,403 @@ dmypy.json # profiling data .prof -# End of https://www.toptal.com/developers/gitignore/api/jetbrains,pycharm,python \ No newline at end of file +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### react ### +.DS_* +**/*.backup.* +**/*.back.* + +node_modules + +*.sublime* + +psd +thumb +sketch + +### ReactNative ### +# React Native Stack Base + +.expo +__generated__ + +### ReactNative.Android Stack ### +# Built application files +*.apk +*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/jarRepositories.xml +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +# Android Profiling +*.hprof + +### ReactNative.Buck Stack ### +buck-out/ +.buckconfig.local +.buckd/ +.buckversion +.fakebuckversion + +### ReactNative.Gradle Stack ### +.gradle + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +### ReactNative.Linux Stack ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### ReactNative.Node Stack ### +# Logs + +# Diagnostic reports (https://nodejs.org/api/report.html) + +# Runtime data + +# Directory for instrumented libs generated by jscoverage/JSCover + +# Coverage directory used by tools like istanbul + +# nyc test coverage + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +# Bower dependency directory (https://bower.io/) + +# node-waf configuration + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +# Dependency directories + +# Snowpack dependency directory (https://snowpack.dev/) + +# TypeScript cache + +# Optional npm cache directory + +# Optional eslint cache + +# Microbundle cache + +# Optional REPL history + +# Output of 'npm pack' + +# Yarn Integrity file + +# dotenv environment variables file + +# parcel-bundler cache (https://parceljs.org/) + +# Next.js build output + +# Nuxt.js build / generate output + +# Gatsby files +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output + +# Serverless directories + +# FuseBox cache + +# DynamoDB Local files + +# TernJS port file + +# Stores VSCode versions used for testing VSCode extensions + +# yarn v2 + +### ReactNative.Xcode Stack ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Gcc Patch +/*.gcno + +### ReactNative.macOS Stack ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# project specifics +*.mp3 +*.mp4 +*.wav +*.wma +*.png +**results/ +**plots/ +**pretrained_models/ +**package-lock.json + +# End of https://www.toptal.com/developers/gitignore/api/jetbrains,pycharm,python.DS_Store diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 37fae98e..8b67fb5f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,2 +1,20 @@ Apollo Release Notes ==================== + +v1.0.0 +======= + +**Added**: + +* Music tagging feature. +* Stem separation feature for two, four and five stems separation. +* User friendly website using React.js and Node.js for features wrapping. +* Audio files upload option. +* Download option. +* Loading zones. +* Flask for backend and frontend integration. Used for requests between both website and models. +* `gunicorn` usage for backend running easing. +* `Herocku CLI` for end-to-end running easing. +* Code documentations added. +* Sample runs added. +* User manual and running usage added. diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..5b335f8e --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +web: gunicorn --chdir server app:app --log-file=- +worker: npm start \ No newline at end of file diff --git a/README.md b/README.md index 845aec91..f05b9a1e 100644 --- a/README.md +++ b/README.md @@ -1 +1,81 @@ -# Apollo \ No newline at end of file +# Apollo + +contributions-welcome-orange + +“Music is the literature of the heart; it commences where speech ends.” \ +― Alphonse de Lamartine, Author + +## Introduction + +In a blooming world, having the art of music with the emerging songs style, types and genres and thousands of songs and +music pieces each with million different beats and the expansion of all music and songs datasets nowadays, splitting the +music source into stems, generating lyrics and classifying genre has become easy and able for all users. + +### What is stem separation? + +Stems are simply units of any given audio signal as per the musical jargon; mixing these units, or as we now know, +stems, produces complex and harmonized sounds. + +Us human beings are superb in isolating these audio signals and process only the sounds we need and suppress those we +don’t need to hear. Humans' minds are really magnificent and capable of doing astonishing stuff, yet, with the +advancement of technology, it is possible to record or create sounds that we can hear later. Now, various sectors deal +with manipulation and study of the sound signals that require stems, thus in that sense, we need algorithms that can +separate audio signals effectively. + +Since we can pick up little inconsistencies in the sound, the stem separation must be as clear and crisp as possible. +Hence, we would harness the capabilities of deep learning, masking and regeneration to recreate individual stems. + +### What is music tagging? + +Music tags is a set of descriptive keywords that carry high-level information about a music clip; those keywords could +reveal information about emotion, genre and instrumentation. + +Hence, tags could be used for music recommendation and discovery. + +![ConfussionMatrix](https://user-images.githubusercontent.com/30150819/124938446-94752f00-e008-11eb-8faf-d5be4a6c76b6.png) + +https://user-images.githubusercontent.com/30150819/124954275-318a9480-e016-11eb-86d0-f0dc4a962a1b.mp4 + +## How To Run + +You'll need to install [`Anaconda`](https://www.anaconda.com/products/individual), +[`Node.js`](https://nodejs.org/en/download/) and [`Heroku CLI`](https://devcenter.heroku.com/articles/heroku-cli) before +running the following script. + +```bash +git clone https://github.com/ZeyadOsama/apollo.git +cd apollo +conda env create --file environment.yml +conda activate apollo +heroku local +``` + +If you don't want to use `Heroku CLI`, you'll run the first script individually, then open two separate terminals and +run each of the following scripts in a terminal. + +```bash +git clone https://github.com/ZeyadOsama/apollo.git +cd apollo +conda env create --file environment.yml +``` + +```bash +conda activate apollo +npm start +``` + +```bash +conda activate apollo +cd server +flask run +``` + +Go to [samples](/samples) for some audio files samples to try the whole project. + +## Changelog + +For all-time versions, please see the [CHANGELOG](CHANGELOG.rst) file. + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) file for details diff --git a/TODO.md b/TODO.md index 943b6997..54c3f127 100644 --- a/TODO.md +++ b/TODO.md @@ -4,24 +4,16 @@ This file should keep track of what to revisit, tasks to be kept into considerat ### Todo -- [ ] User friendly website. -- [ ] Effective ways of make a website screen size adjustable by using some great things in HTML and CSS. -- [ ] JSON responses from backend to frontend and vice versa. -- [ ] Stem separation. -- [ ] Genre classification. -- [ ] Spleeter wrapper. - [ ] Jobs interfaces and executors. - [ ] Apollo API. - [ ] Flask API. - [ ] `PyTest`(s) -- [ ] Complete `setup.py` file. for `pip` installation. -- [ ] Complete code documentation. -- [ ] Complete project documentation. - -### In Progress - -- [ ] PLACE-HOLDER +- [ ] Create `setup.py` file. for `pip` installation. ### Done -- [x] PLACE-HOLDER \ No newline at end of file +- [x] User friendly website. +- [x] Effective ways of make a website screen size adjustable by using some great things in HTML and CSS. +- [x] Stem separation. +- [x] Genre classification. +- [x] Spleeter wrapper. diff --git a/apollo.ipynb b/apollo.ipynb deleted file mode 100644 index 654a44e8..00000000 --- a/apollo.ipynb +++ /dev/null @@ -1,46 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } - }, - { - "cell_type": "markdown", - "source": [ - "# Apollo Notebook" - ], - "metadata": { - "collapsed": false - } - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} \ No newline at end of file diff --git a/apollo/__main__.py b/apollo/__main__.py index 54b08a6a..faadae49 100644 --- a/apollo/__main__.py +++ b/apollo/__main__.py @@ -1,2 +1,18 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +__main__.py: +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + + +def entrypoint(): + """ Application entrypoint. """ + pass + + if __name__ == '__main__': pass diff --git a/apollo/common/convertors/__init__.py b/apollo/common/convertors/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apollo/common/logger/__init__.py b/apollo/common/logger/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apollo/common/misc/__init__.py b/apollo/common/misc/__init__.py new file mode 100644 index 00000000..a2fc707b --- /dev/null +++ b/apollo/common/misc/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# coding: utf8 + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +""" Packages that provides miscellaneous helpers the library. """ diff --git a/apollo/common/misc/constants.py b/apollo/common/misc/constants.py new file mode 100644 index 00000000..f6c2c112 --- /dev/null +++ b/apollo/common/misc/constants.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +constants.py: +File containing miscellaneous constants, like return codes for example +to be used as status flags for all packages. +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +from enum import IntEnum + + +class ReturnCode(IntEnum): + """ + ReturnCodes enum class to be used as status flags for all packages. + """ + APOLLO_RC_FAILURE = 0 + APOLLO_RC_SUCCESS = 1 + APOLLO_RC_ABORTED = 2 diff --git a/apollo/common/misc/exceptions.py b/apollo/common/misc/exceptions.py new file mode 100644 index 00000000..4f5aa65e --- /dev/null +++ b/apollo/common/misc/exceptions.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +exceptions.py: +File containing exceptions classes to be used by different components. +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + + +class Undefined(Exception): + """Exception raised for errors. + """ + + def __init__(self): + super().__init__("") diff --git a/apollo/engine/genre_classification/MSD_musicnn/.data-00000-of-00001 b/apollo/engine/genre_classification/MSD_musicnn/.data-00000-of-00001 new file mode 100644 index 00000000..e5be466c Binary files /dev/null and b/apollo/engine/genre_classification/MSD_musicnn/.data-00000-of-00001 differ diff --git a/apollo/engine/genre_classification/MSD_musicnn/.index b/apollo/engine/genre_classification/MSD_musicnn/.index new file mode 100644 index 00000000..328f5c0b Binary files /dev/null and b/apollo/engine/genre_classification/MSD_musicnn/.index differ diff --git a/apollo/engine/genre_classification/MSD_musicnn/.meta b/apollo/engine/genre_classification/MSD_musicnn/.meta new file mode 100644 index 00000000..0de37d01 Binary files /dev/null and b/apollo/engine/genre_classification/MSD_musicnn/.meta differ diff --git a/apollo/engine/genre_classification/MSD_musicnn/checkpoint b/apollo/engine/genre_classification/MSD_musicnn/checkpoint new file mode 100644 index 00000000..1d9cd394 --- /dev/null +++ b/apollo/engine/genre_classification/MSD_musicnn/checkpoint @@ -0,0 +1,2 @@ +model_checkpoint_path: "/home/jpons/MSDtagging/data/experiments/1562267674ismir_17/" +all_model_checkpoint_paths: "/home/jpons/MSDtagging/data/experiments/1562267674ismir_17/" diff --git a/apollo/engine/genre_classification/MSD_musicnn/config.json b/apollo/engine/genre_classification/MSD_musicnn/config.json new file mode 100644 index 00000000..877851c0 --- /dev/null +++ b/apollo/engine/genre_classification/MSD_musicnn/config.json @@ -0,0 +1,92 @@ +{ + "name_run": "", + "audio_representation_folder": "audio_representation/msd__time-freq/", + "gt_train": "index/msd/train_gt_msd.tsv", + "gt_val": "index/msd/val_gt_msd.tsv", + "n_frames": 187, + "pre_processing": "logC", + "pad_short": "repeat-pad", + "train_sampling": "random", + "param_train_sampling": 1, + "model_number": 17, + "load_model": null, + "epochs": 6000, + "batch_size": 32, + "weight_decay": 1e-05, + "learning_rate": 0.001, + "optimizer": "Adam", + "patience": 75, + "num_classes_dataset": 50, + "val_batch_size": 32, + "audio_rep": { + "identifier": "msd", + "audio_folder": "/data/MSD/millionsong-audio/mp3/", + "n_machines": 1, + "machine_i": 0, + "num_processing_units": 20, + "type": "time-freq", + "spectrogram_type": "mel", + "resample_sr": 16000, + "hop": 256, + "n_fft": 512, + "n_mels": 96, + "index_file": "index/msd/index_msd.tsv", + "audio_representation_folder": "audio_representation/msd__time-freq/", + "normalize_mean": null, + "normalize_std": null + }, + "xInput": 187, + "yInput": 96, + "classes_vector": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49 + ] +} \ No newline at end of file diff --git a/apollo/engine/genre_classification/MSD_musicnn/experiment.result b/apollo/engine/genre_classification/MSD_musicnn/experiment.result new file mode 100644 index 00000000..534a884b --- /dev/null +++ b/apollo/engine/genre_classification/MSD_musicnn/experiment.result @@ -0,0 +1,3 @@ +Experiment: ['1562267674ismir_17'] +AUC: 0.8801927178090048 +AUC: 0.28906431196994925 \ No newline at end of file diff --git a/apollo/engine/genre_classification/MSD_musicnn/train_log.tsv b/apollo/engine/genre_classification/MSD_musicnn/train_log.tsv new file mode 100644 index 00000000..9f4753ea --- /dev/null +++ b/apollo/engine/genre_classification/MSD_musicnn/train_log.tsv @@ -0,0 +1,1005 @@ +Epoch train_cost val_cost epoch_time learing_rate +1 nan 3.16561 258.477s 0.001 +2 0.152141 0.12559 1554.4s 0.001 +3 0.125789 0.126368 1492.72s 0.001 +4 0.123811 0.120357 1536.21s 0.001 +5 0.122262 0.120124 1513.01s 0.001 +6 0.121211 0.119465 1491.32s 0.001 +7 0.12028 0.117293 1544.56s 0.001 +8 0.119512 0.118006 1492.36s 0.001 +9 0.118931 0.118017 1491.22s 0.001 +10 0.118634 0.116009 1492.34s 0.001 +11 0.118231 0.115731 1493.95s 0.001 +12 0.117921 0.116731 1492.12s 0.001 +13 0.117671 0.115292 1494.79s 0.001 +14 0.117497 0.114279 1492.52s 0.001 +15 0.117373 0.114833 1492.94s 0.001 +16 0.117094 0.115814 1492.13s 0.001 +17 0.117008 0.114669 1492.23s 0.001 +18 0.116851 0.11392 1491.51s 0.001 +19 0.116732 0.115629 1578.12s 0.001 +20 0.116701 0.114104 1494.05s 0.001 +21 0.116544 0.114301 1493.72s 0.001 +22 0.116561 0.115015 1491.88s 0.001 +23 0.116416 0.114968 1490.52s 0.001 +24 0.116309 0.114622 1491.6s 0.001 +25 0.116326 0.114029 1491.4s 0.001 +26 0.116235 0.11357 1492.5s 0.001 +27 0.116145 0.114215 1490.76s 0.001 +28 0.116126 0.114429 1575.96s 0.001 +29 0.11608 0.116394 1490.96s 0.001 +30 0.11608 0.113994 1490.53s 0.001 +31 0.11611 0.114845 1490.49s 0.001 +32 0.116045 0.114136 1489.02s 0.001 +33 0.115981 0.114513 1489.54s 0.001 +34 0.116043 0.114527 1488.21s 0.001 +35 0.115984 0.114467 1490.95s 0.001 +36 0.115994 0.113863 1488.89s 0.001 +37 0.115942 0.115425 1491.01s 0.001 +38 0.11597 0.114624 1489.68s 0.001 +39 0.115909 0.114911 1491.39s 0.001 +40 0.115941 0.115078 1489.99s 0.001 +41 0.115892 0.115779 1490.82s 0.001 +42 0.115933 0.112981 1491.67s 0.001 +43 0.115905 0.114798 1500.1s 0.001 +44 0.115807 0.114789 1498.12s 0.001 +45 0.115816 0.114219 1498.88s 0.001 +46 0.115795 0.113827 1550.46s 0.001 +47 0.115783 0.11362 1498.8s 0.001 +48 0.115858 0.114376 1517.98s 0.001 +49 0.115802 0.113415 1545.82s 0.001 +50 0.115836 0.11395 1490.89s 0.001 +51 0.115833 0.113706 1492.99s 0.001 +52 0.11576 0.11356 1493.99s 0.001 +53 0.11567 0.114354 1492.12s 0.001 +54 0.11581 0.112978 1491.75s 0.001 +55 0.115785 0.115969 1491.98s 0.001 +56 0.115845 0.114227 1492.25s 0.001 +57 0.115696 0.114365 1493.46s 0.001 +58 0.115796 0.114558 1491.86s 0.001 +59 0.115707 0.115249 1491.8s 0.001 +60 0.115721 0.113578 1491.92s 0.001 +61 0.115779 0.11523 1689.41s 0.001 +62 0.115703 0.113437 1508.99s 0.001 +63 0.115672 0.1144 1489.56s 0.001 +64 0.11576 0.113827 1509.56s 0.001 +65 0.115736 0.114759 1492.04s 0.001 +66 0.115611 0.114236 1509.77s 0.001 +67 0.115714 0.11507 1494.07s 0.001 +68 0.115614 0.115218 1492.07s 0.001 +69 0.115683 0.114212 1490.61s 0.001 +70 0.115673 0.114002 1490.1s 0.001 +71 0.115697 0.113783 1491.02s 0.001 +72 0.115573 0.115034 1492.07s 0.001 +73 0.115693 0.114733 1490.06s 0.001 +74 0.115706 0.114562 1492.03s 0.001 +75 0.115629 0.114134 1489.7s 0.001 +76 0.115657 0.11371 1490.14s 0.001 +77 0.115645 0.114957 1489.41s 0.001 +78 0.115753 0.113086 1491.62s 0.001 +79 0.115603 0.113883 1489.75s 0.001 +80 0.115618 0.114023 1488.73s 0.001 +81 0.115713 0.113837 1491.7s 0.001 +82 0.115693 0.113317 1489.93s 0.001 +83 0.1156 0.114478 1487.8s 0.001 +84 0.115632 0.114793 1491.72s 0.001 +85 0.115639 0.113073 1488.14s 0.001 +86 0.11566 0.113549 1489.51s 0.001 +87 0.115597 0.113442 1491.9s 0.001 +88 0.115659 0.112933 1491.11s 0.001 +89 0.115578 0.113034 1491.64s 0.001 +90 0.115639 0.114057 1490.89s 0.001 +91 0.115621 0.11596 1489.37s 0.001 +92 0.113851 0.110667 1491.38s 0.0005 +93 0.113242 0.110366 1491.47s 0.0005 +94 0.112927 0.110416 1493.47s 0.0005 +95 0.112916 0.111678 1491.53s 0.0005 +96 0.112768 0.109907 1492.67s 0.0005 +97 0.1128 0.110811 1493.13s 0.0005 +98 0.112747 0.111213 1491.41s 0.0005 +99 0.112724 0.110621 1493.2s 0.0005 +100 0.112725 0.110053 1492.9s 0.0005 +101 0.112691 0.109885 1492.77s 0.0005 +102 0.11265 0.110438 1494.48s 0.0005 +103 0.112633 0.110016 1492.14s 0.0005 +104 0.112592 0.110654 1490.76s 0.0005 +105 0.112627 0.110075 1493.63s 0.0005 +106 0.11254 0.110195 1492.27s 0.0005 +107 0.112531 0.109389 1494.8s 0.0005 +108 0.112569 0.109791 1491.87s 0.0005 +109 0.1125 0.110091 1494.38s 0.0005 +110 0.112546 0.11019 1493.75s 0.0005 +111 0.112648 0.110165 1493.36s 0.0005 +112 0.112621 0.110265 1494.09s 0.0005 +113 0.112442 0.110626 2241.23s 0.0005 +114 0.11259 0.110484 2058.36s 0.0005 +115 0.112449 0.110376 1496.41s 0.0005 +116 0.112502 0.1098 1494s 0.0005 +117 0.112585 0.111273 1494.83s 0.0005 +118 0.112534 0.110088 1490.98s 0.0005 +119 0.112522 0.109806 1519.17s 0.0005 +120 0.112497 0.110234 1543.66s 0.0005 +121 0.112495 0.109837 1510.06s 0.0005 +122 0.112516 0.10953 1498.81s 0.0005 +123 0.112492 0.109924 1493.05s 0.0005 +124 0.112464 0.110212 1492.92s 0.0005 +125 0.112459 0.109475 1493.88s 0.0005 +126 0.112497 0.109845 1490.86s 0.0005 +127 0.112488 0.110219 1493.14s 0.0005 +128 0.112452 0.110329 1491.12s 0.0005 +129 0.112484 0.110244 1491.9s 0.0005 +130 0.112474 0.109708 1491.17s 0.0005 +131 0.112463 0.110307 1492.23s 0.0005 +132 0.112427 0.110137 1490.36s 0.0005 +133 0.112419 0.110042 1491.59s 0.0005 +134 0.112502 0.109409 1493.17s 0.0005 +135 0.112455 0.109962 1493.96s 0.0005 +136 0.112431 0.109909 1491.98s 0.0005 +137 0.112528 0.109833 1493.29s 0.0005 +138 0.112509 0.109988 1493.61s 0.0005 +139 0.112476 0.109952 1493.43s 0.0005 +140 0.112431 0.109968 1492.59s 0.0005 +141 0.112343 0.110096 1491.65s 0.0005 +142 0.112531 0.110084 1491.88s 0.0005 +143 0.112453 0.109701 1491.82s 0.0005 +144 0.112461 0.109881 2075.68s 0.0005 +145 0.112506 0.109995 2272.96s 0.0005 +146 0.112467 0.109698 2270.09s 0.0005 +147 0.112372 0.109769 1511.88s 0.0005 +148 0.112393 0.109432 1492.19s 0.0005 +149 0.11239 0.110239 1493.28s 0.0005 +150 0.112454 0.109652 1489.32s 0.0005 +151 0.112385 0.109673 1490.76s 0.0005 +152 0.112503 0.109579 1492.27s 0.0005 +153 0.11242 0.110171 1490.26s 0.0005 +154 0.112428 0.110169 1492.34s 0.0005 +155 0.112399 0.110369 1491.47s 0.0005 +156 0.112432 0.109434 1492.63s 0.0005 +157 0.11245 0.110214 1489.78s 0.0005 +158 0.112366 0.110426 1492.57s 0.0005 +159 0.112416 0.110663 1491.53s 0.0005 +160 0.112441 0.110633 1492.01s 0.0005 +161 0.112413 0.110188 1493.54s 0.0005 +162 0.112335 0.110277 1492s 0.0005 +163 0.112384 0.11024 1491.78s 0.0005 +164 0.112375 0.110317 1490.41s 0.0005 +165 0.112388 0.110126 1492.37s 0.0005 +166 0.112449 0.110305 1492.41s 0.0005 +167 0.112413 0.10959 1493.33s 0.0005 +168 0.112461 0.109737 1491.42s 0.0005 +169 0.112432 0.109728 1493.59s 0.0005 +170 0.112419 0.109494 1494.53s 0.0005 +171 0.11238 0.110425 1492.49s 0.0005 +172 0.111298 0.108671 1494.96s 0.00025 +173 0.110936 0.108127 1493.79s 0.00025 +174 0.110834 0.107662 1493.51s 0.00025 +175 0.110647 0.107647 1495.18s 0.00025 +176 0.110533 0.107943 1500.9s 0.00025 +177 0.110579 0.107928 1492.2s 0.00025 +178 0.110462 0.108028 1492.94s 0.00025 +179 0.110443 0.107524 1511.8s 0.00025 +180 0.110445 0.107813 1533.12s 0.00025 +181 0.110349 0.107981 1492.69s 0.00025 +182 0.110394 0.107786 1491.97s 0.00025 +183 0.110364 0.107722 1491.89s 0.00025 +184 0.110385 0.107517 1494.66s 0.00025 +185 0.110329 0.107679 1490.79s 0.00025 +186 0.110369 0.107565 1490.71s 0.00025 +187 0.110294 0.107652 1491.93s 0.00025 +188 0.11026 0.107812 1491.48s 0.00025 +189 0.110312 0.107863 1489.19s 0.00025 +190 0.110235 0.107573 1490.4s 0.00025 +191 0.110256 0.107784 1490.75s 0.00025 +192 0.110276 0.107565 1489.22s 0.00025 +193 0.110188 0.107672 1490.96s 0.00025 +194 0.110313 0.108048 1491.37s 0.00025 +195 0.110204 0.107946 1492.18s 0.00025 +196 0.110301 0.107387 1492.38s 0.00025 +197 0.11026 0.107941 1490.95s 0.00025 +198 0.110274 0.1073 1491.48s 0.00025 +199 0.110219 0.107745 1491.33s 0.00025 +200 0.110254 0.107529 1492.16s 0.00025 +201 0.110255 0.107794 1493.03s 0.00025 +202 0.110291 0.107418 1490.24s 0.00025 +203 0.110266 0.107647 1490.75s 0.00025 +204 0.110194 0.107385 1490.31s 0.00025 +205 0.110215 0.107665 1491.87s 0.00025 +206 0.110219 0.107827 1493.15s 0.00025 +207 0.110318 0.107454 1490.13s 0.00025 +208 0.110188 0.10769 1490.13s 0.00025 +209 0.110105 0.107542 1492.34s 0.00025 +210 0.110121 0.107291 1489.55s 0.00025 +211 0.110121 0.107277 1492.82s 0.00025 +212 0.110163 0.107658 1493.89s 0.00025 +213 0.110177 0.108081 1492.73s 0.00025 +214 0.11022 0.107664 1492.09s 0.00025 +215 0.110103 0.107396 1493.16s 0.00025 +216 0.110255 0.108484 1493.85s 0.00025 +217 0.110189 0.107711 1492.17s 0.00025 +218 0.110188 0.108326 1493.22s 0.00025 +219 0.110214 0.107633 1491.42s 0.00025 +220 0.11024 0.107342 1854.9s 0.00025 +221 0.110147 0.107194 1494.05s 0.00025 +222 0.110201 0.107292 1491.65s 0.00025 +223 0.110033 0.107219 1492.88s 0.00025 +224 0.11018 0.107564 1490.53s 0.00025 +225 0.110156 0.107429 1488.61s 0.00025 +226 0.110174 0.107675 1489.5s 0.00025 +227 0.110118 0.107741 1490.83s 0.00025 +228 0.11016 0.107355 1491.68s 0.00025 +229 0.110202 0.107793 1491.7s 0.00025 +230 0.110186 0.107768 1491.75s 0.00025 +231 0.110196 0.107299 1490.48s 0.00025 +232 0.110103 0.107826 1491.09s 0.00025 +233 0.110185 0.107588 1491.54s 0.00025 +234 0.11009 0.107158 1490.72s 0.00025 +235 0.110232 0.107326 1505.85s 0.00025 +236 0.110119 0.107126 1493.45s 0.00025 +237 0.110173 0.107826 1491.99s 0.00025 +238 0.110081 0.107194 1501.11s 0.00025 +239 0.110184 0.107498 1490.94s 0.00025 +240 0.110097 0.10792 1489.48s 0.00025 +241 0.110098 0.107654 1491.42s 0.00025 +242 0.11015 0.107579 1489.78s 0.00025 +243 0.110137 0.107546 1488.62s 0.00025 +244 0.110138 0.107595 1490.45s 0.00025 +245 0.110069 0.107722 1492.56s 0.00025 +246 0.110089 0.107275 1491.18s 0.00025 +247 0.110079 0.107998 1492.83s 0.00025 +248 0.110135 0.107368 1488.23s 0.00025 +249 0.110181 0.107699 1492.49s 0.00025 +250 0.110038 0.107102 1490.75s 0.00025 +251 0.110151 0.107493 1490.6s 0.00025 +252 0.110064 0.107156 1490.7s 0.00025 +253 0.11016 0.107494 1492.56s 0.00025 +254 0.110069 0.107318 1491.32s 0.00025 +255 0.110125 0.107449 1493.23s 0.00025 +256 0.110103 0.107527 1489.89s 0.00025 +257 0.110074 0.107675 1491.7s 0.00025 +258 0.110103 0.107025 1491.15s 0.00025 +259 0.110096 0.107718 1493.28s 0.00025 +260 0.110094 0.107247 1491.81s 0.00025 +261 0.110101 0.107439 1491.92s 0.00025 +262 0.109375 0.106665 1491.92s 0.000125 +263 0.10922 0.106314 1493.25s 0.000125 +264 0.10916 0.106265 1491.6s 0.000125 +265 0.109006 0.106431 1489.97s 0.000125 +266 0.109086 0.105947 1490.73s 0.000125 +267 0.108931 0.105946 1491.57s 0.000125 +268 0.108928 0.105994 1491.85s 0.000125 +269 0.108839 0.106273 1491.67s 0.000125 +270 0.108856 0.105869 1492.85s 0.000125 +271 0.108896 0.106088 1492.16s 0.000125 +272 0.108823 0.106029 1489.84s 0.000125 +273 0.108795 0.106128 1491.73s 0.000125 +274 0.108741 0.105954 1492.9s 0.000125 +275 0.108771 0.106252 1491.91s 0.000125 +276 0.108749 0.10595 1492.07s 0.000125 +277 0.108721 0.106409 1492s 0.000125 +278 0.108659 0.105863 1493.35s 0.000125 +279 0.108657 0.10587 1492.91s 0.000125 +280 0.108615 0.105853 1493.66s 0.000125 +281 0.108739 0.105906 1491.49s 0.000125 +282 0.108711 0.105837 1492.13s 0.000125 +283 0.108642 0.105846 1492.17s 0.000125 +284 0.108611 0.106119 1494.87s 0.000125 +285 0.108693 0.106403 1494.13s 0.000125 +286 0.108617 0.105911 1493.54s 0.000125 +287 0.108657 0.105872 1492.89s 0.000125 +288 0.108577 0.105687 1490.41s 0.000125 +289 0.108574 0.105833 1494.03s 0.000125 +290 0.108716 0.10591 1494.79s 0.000125 +291 0.108675 0.106566 1493.4s 0.000125 +292 0.108585 0.105719 1526.86s 0.000125 +293 0.108586 0.106148 1494.31s 0.000125 +294 0.1086 0.105715 1500.2s 0.000125 +295 0.108567 0.105837 1510.41s 0.000125 +296 0.108593 0.10574 1504.91s 0.000125 +297 0.108636 0.105799 1491.49s 0.000125 +298 0.108653 0.105626 1491.05s 0.000125 +299 0.108565 0.106121 1492.77s 0.000125 +300 0.108583 0.105676 1493.18s 0.000125 +301 0.108461 0.105634 1491.6s 0.000125 +302 0.108598 0.105498 1492.79s 0.000125 +303 0.108477 0.105808 1495.04s 0.000125 +304 0.10866 0.105655 1491.17s 0.000125 +305 0.108612 0.105892 1492.4s 0.000125 +306 0.10861 0.105657 1489.84s 0.000125 +307 0.108591 0.106524 1490.77s 0.000125 +308 0.10854 0.105723 1492.01s 0.000125 +309 0.108588 0.105851 1490.92s 0.000125 +310 0.108557 0.105747 1493.23s 0.000125 +311 0.108513 0.105734 1491.17s 0.000125 +312 0.108501 0.105767 1491.87s 0.000125 +313 0.108518 0.105887 1491.94s 0.000125 +314 0.108536 0.105823 1492.43s 0.000125 +315 0.108478 0.105846 1491.58s 0.000125 +316 0.108522 0.106103 1490.1s 0.000125 +317 0.10852 0.106005 1491.2s 0.000125 +318 0.108499 0.105826 1488.96s 0.000125 +319 0.108561 0.105886 1491.78s 0.000125 +320 0.108565 0.105732 1490.54s 0.000125 +321 0.108503 0.105678 1489.95s 0.000125 +322 0.108529 0.106098 1490.8s 0.000125 +323 0.108437 0.105614 1492.29s 0.000125 +324 0.108546 0.105863 1491.72s 0.000125 +325 0.10854 0.105741 1491.96s 0.000125 +326 0.108484 0.10581 1491.6s 0.000125 +327 0.108489 0.10559 1492.61s 0.000125 +328 0.108487 0.105993 1493.52s 0.000125 +329 0.108432 0.105892 1492.17s 0.000125 +330 0.108531 0.106067 1491.34s 0.000125 +331 0.108457 0.106105 1491.98s 0.000125 +332 0.10851 0.105993 1494.41s 0.000125 +333 0.108539 0.105628 1492.93s 0.000125 +334 0.108547 0.10583 1493.04s 0.000125 +335 0.108415 0.105999 1493.5s 0.000125 +336 0.108479 0.105882 1494.97s 0.000125 +337 0.108431 0.105625 1494.15s 0.000125 +338 0.1085 0.105512 1495.5s 0.000125 +339 0.108413 0.105872 1494.09s 0.000125 +340 0.108514 0.106119 1493.7s 0.000125 +341 0.108613 0.106067 1493.74s 0.000125 +342 0.108372 0.105556 1493.94s 0.000125 +343 0.108487 0.10608 1494.04s 0.000125 +344 0.108509 0.105486 1493.01s 0.000125 +345 0.108487 0.106082 1494.11s 0.000125 +346 0.108445 0.105387 1493.51s 0.000125 +347 0.108408 0.105757 1494.55s 0.000125 +348 0.108377 0.105564 1594.27s 0.000125 +349 0.108494 0.105681 1700.38s 0.000125 +350 0.108493 0.105628 1493.06s 0.000125 +351 0.108115 0.105208 1495.28s 6.25e-05 +352 0.107921 0.105139 1494.78s 6.25e-05 +353 0.107808 0.104982 1511.2s 6.25e-05 +354 0.107852 0.104897 1508.81s 6.25e-05 +355 0.10783 0.105023 1494.24s 6.25e-05 +356 0.107741 0.104972 1494.06s 6.25e-05 +357 0.107811 0.104854 1493.25s 6.25e-05 +358 0.107674 0.104867 1492.64s 6.25e-05 +359 0.107707 0.104961 1492.75s 6.25e-05 +360 0.107695 0.10481 1491.24s 6.25e-05 +361 0.107605 0.104827 1492.9s 6.25e-05 +362 0.107699 0.10495 1493.06s 6.25e-05 +363 0.107644 0.104713 1492.33s 6.25e-05 +364 0.107627 0.104836 1491.87s 6.25e-05 +365 0.107604 0.104831 1490.54s 6.25e-05 +366 0.107639 0.10481 1492.96s 6.25e-05 +367 0.107575 0.104897 1701.58s 6.25e-05 +368 0.107602 0.105171 2274.76s 6.25e-05 +369 0.107578 0.104757 2280.06s 6.25e-05 +370 0.107615 0.104715 1679.23s 6.25e-05 +371 0.107619 0.105095 1491.78s 6.25e-05 +372 0.107533 0.105098 1489.62s 6.25e-05 +373 0.107465 0.104953 1490.01s 6.25e-05 +374 0.107477 0.104812 1490.6s 6.25e-05 +375 0.107566 0.104957 1491.66s 6.25e-05 +376 0.107523 0.104744 1491.01s 6.25e-05 +377 0.107534 0.104746 1492.34s 6.25e-05 +378 0.107513 0.104903 1491.5s 6.25e-05 +379 0.10747 0.104731 1491.47s 6.25e-05 +380 0.107567 0.104835 1490.75s 6.25e-05 +381 0.107504 0.104815 1492.18s 6.25e-05 +382 0.107527 0.104905 1491.49s 6.25e-05 +383 0.107494 0.10463 1492.34s 6.25e-05 +384 0.107458 0.104577 1490.39s 6.25e-05 +385 0.107529 0.104845 1492.64s 6.25e-05 +386 0.107507 0.104564 1490.31s 6.25e-05 +387 0.107509 0.104669 1490.78s 6.25e-05 +388 0.107392 0.104626 1490.32s 6.25e-05 +389 0.107403 0.104592 1492.64s 6.25e-05 +390 0.107392 0.104799 1490.82s 6.25e-05 +391 0.107489 0.104736 1490.86s 6.25e-05 +392 0.107468 0.104931 1491.56s 6.25e-05 +393 0.107388 0.10474 1491.86s 6.25e-05 +394 0.107482 0.104699 1491.5s 6.25e-05 +395 0.107457 0.104869 1493.13s 6.25e-05 +396 0.107479 0.104733 1492.35s 6.25e-05 +397 0.107448 0.104922 1490.71s 6.25e-05 +398 0.107498 0.104596 1492.21s 6.25e-05 +399 0.107428 0.104746 1490.17s 6.25e-05 +400 0.107424 0.104753 1491.6s 6.25e-05 +401 0.107446 0.104684 1492.71s 6.25e-05 +402 0.107353 0.10475 1492.81s 6.25e-05 +403 0.10754 0.104794 1490.71s 6.25e-05 +404 0.107495 0.104868 1491.42s 6.25e-05 +405 0.107449 0.104537 1491.99s 6.25e-05 +406 0.107471 0.104841 1494.12s 6.25e-05 +407 0.107412 0.104685 1491.6s 6.25e-05 +408 0.107367 0.104718 1550.19s 6.25e-05 +409 0.10743 0.104671 1519.12s 6.25e-05 +410 0.107416 0.104682 1491.6s 6.25e-05 +411 0.107437 0.104754 1494.07s 6.25e-05 +412 0.107283 0.104604 1745.41s 6.25e-05 +413 0.107429 0.104601 1492.01s 6.25e-05 +414 0.107409 0.104694 1491.76s 6.25e-05 +415 0.107425 0.104649 1491.75s 6.25e-05 +416 0.107348 0.104879 1492.7s 6.25e-05 +417 0.107368 0.104794 1491.88s 6.25e-05 +418 0.107454 0.10469 1492.17s 6.25e-05 +419 0.107423 0.104594 1491.96s 6.25e-05 +420 0.107372 0.104442 1492.01s 6.25e-05 +421 0.10735 0.10471 1491.5s 6.25e-05 +422 0.107399 0.104608 1489.78s 6.25e-05 +423 0.107344 0.104464 1491.11s 6.25e-05 +424 0.107383 0.104612 1493.2s 6.25e-05 +425 0.107459 0.104607 1491.92s 6.25e-05 +426 0.107432 0.104446 1492.1s 6.25e-05 +427 0.107258 0.104523 1490.13s 6.25e-05 +428 0.107377 0.104561 1489.77s 6.25e-05 +429 0.107363 0.104834 1487.9s 6.25e-05 +430 0.107399 0.104586 1489.59s 6.25e-05 +431 0.10738 0.104705 1487.92s 6.25e-05 +432 0.107395 0.104709 1488.57s 6.25e-05 +433 0.107325 0.104641 1488.75s 6.25e-05 +434 0.107381 0.104504 1501.57s 6.25e-05 +435 0.107361 0.104654 1451.37s 6.25e-05 +436 0.107301 0.104532 1489.84s 6.25e-05 +437 0.107341 0.104679 1489.2s 6.25e-05 +438 0.1071 0.104171 1492.53s 3.125e-05 +439 0.10699 0.104238 1493.73s 3.125e-05 +440 0.106966 0.104112 1492.98s 3.125e-05 +441 0.106905 0.104242 1489.82s 3.125e-05 +442 0.106968 0.104236 1489.45s 3.125e-05 +443 0.107018 0.10417 1492.5s 3.125e-05 +444 0.106941 0.104192 1489.95s 3.125e-05 +445 0.106928 0.104145 1489.42s 3.125e-05 +446 0.106929 0.104203 1487.65s 3.125e-05 +447 0.106902 0.1042 1489.4s 3.125e-05 +448 0.106841 0.104106 1490.46s 3.125e-05 +449 0.106865 0.104052 1491.15s 3.125e-05 +450 0.106847 0.104123 1492.54s 3.125e-05 +451 0.10687 0.104173 1493.12s 3.125e-05 +452 0.106901 0.104148 1493.24s 3.125e-05 +453 0.106817 0.104207 1493.44s 3.125e-05 +454 0.106876 0.104049 1492.11s 3.125e-05 +455 0.106837 0.10413 1494.51s 3.125e-05 +456 0.106892 0.104001 1490.82s 3.125e-05 +457 0.106886 0.104178 1493.03s 3.125e-05 +458 0.106841 0.104074 1492.13s 3.125e-05 +459 0.106891 0.104074 1492.87s 3.125e-05 +460 0.106828 0.10397 1493.08s 3.125e-05 +461 0.106799 0.104024 1492.66s 3.125e-05 +462 0.106724 0.103943 1492.64s 3.125e-05 +463 0.106831 0.104058 1495.19s 3.125e-05 +464 0.106855 0.103977 1646.24s 3.125e-05 +465 0.106836 0.103932 1494.9s 3.125e-05 +466 0.106857 0.104072 1509.52s 3.125e-05 +467 0.106727 0.104007 1509.74s 3.125e-05 +468 0.106828 0.103998 1492.46s 3.125e-05 +469 0.106646 0.103999 1505.05s 3.125e-05 +470 0.106783 0.104038 1494.28s 3.125e-05 +471 0.106808 0.104024 1512.49s 3.125e-05 +472 0.106723 0.10397 1494.08s 3.125e-05 +473 0.106825 0.103988 1493.46s 3.125e-05 +474 0.106772 0.104039 1493.27s 3.125e-05 +475 0.106721 0.103955 1494.17s 3.125e-05 +476 0.106808 0.104051 1494.48s 3.125e-05 +477 0.10678 0.103936 1493.21s 3.125e-05 +478 0.106673 0.103919 1492.46s 3.125e-05 +479 0.106787 0.103894 1490.93s 3.125e-05 +480 0.106739 0.1041 1492.15s 3.125e-05 +481 0.106733 0.103891 1492.06s 3.125e-05 +482 0.106748 0.103974 1494.07s 3.125e-05 +483 0.106672 0.103914 1492.76s 3.125e-05 +484 0.106661 0.103914 1495.21s 3.125e-05 +485 0.106718 0.104051 1494.35s 3.125e-05 +486 0.106808 0.103947 1495.54s 3.125e-05 +487 0.106684 0.104105 1494.35s 3.125e-05 +488 0.106683 0.103963 1494.99s 3.125e-05 +489 0.106717 0.103942 1492.11s 3.125e-05 +490 0.106644 0.103921 1492.22s 3.125e-05 +491 0.106802 0.103939 1492.41s 3.125e-05 +492 0.106682 0.104027 1491.94s 3.125e-05 +493 0.106833 0.104032 1494.79s 3.125e-05 +494 0.106695 0.10409 1495.33s 3.125e-05 +495 0.106619 0.103926 1494.01s 3.125e-05 +496 0.106737 0.103851 2133.58s 3.125e-05 +497 0.10661 0.104003 2332.37s 3.125e-05 +498 0.106723 0.104011 1494.42s 3.125e-05 +499 0.106811 0.103962 1493.39s 3.125e-05 +500 0.106746 0.103929 1493.89s 3.125e-05 +501 0.106682 0.103853 1493.54s 3.125e-05 +502 0.106741 0.103952 1492.09s 3.125e-05 +503 0.106656 0.10395 1490.95s 3.125e-05 +504 0.106634 0.103927 1493.38s 3.125e-05 +505 0.106703 0.103857 1493.96s 3.125e-05 +506 0.106726 0.103851 1492.72s 3.125e-05 +507 0.106584 0.103965 1493.63s 3.125e-05 +508 0.10667 0.103928 1885.03s 3.125e-05 +509 0.106641 0.103877 1494.14s 3.125e-05 +510 0.106656 0.103793 1493.02s 3.125e-05 +511 0.106735 0.103966 1494.69s 3.125e-05 +512 0.106679 0.103982 1495.69s 3.125e-05 +513 0.106705 0.103829 1492.26s 3.125e-05 +514 0.106639 0.103891 1493.65s 3.125e-05 +515 0.106734 0.103846 1493.68s 3.125e-05 +516 0.10662 0.103814 1492.81s 3.125e-05 +517 0.106672 0.103865 1495.57s 3.125e-05 +518 0.106669 0.103903 1493.73s 3.125e-05 +519 0.106696 0.104169 1494.29s 3.125e-05 +520 0.106645 0.103808 1495.31s 3.125e-05 +521 0.106601 0.103794 1499.32s 3.125e-05 +522 0.106668 0.103878 1493.11s 3.125e-05 +523 0.106659 0.103819 1519.49s 3.125e-05 +524 0.106661 0.103813 1518.58s 3.125e-05 +525 0.106616 0.104121 1493.19s 3.125e-05 +526 0.106706 0.103977 1518.6s 3.125e-05 +527 0.10648 0.103732 1691.92s 1.5625e-05 +528 0.106412 0.103648 1494.15s 1.5625e-05 +529 0.106494 0.103698 1493.73s 1.5625e-05 +530 0.106462 0.103688 1493.36s 1.5625e-05 +531 0.106429 0.103662 1493.62s 1.5625e-05 +532 0.106428 0.103587 1493.6s 1.5625e-05 +533 0.106371 0.10368 1493.84s 1.5625e-05 +534 0.106349 0.103666 1492.3s 1.5625e-05 +535 0.106359 0.103573 1492.28s 1.5625e-05 +536 0.106322 0.103657 1490.68s 1.5625e-05 +537 0.106444 0.103647 1492.9s 1.5625e-05 +538 0.106366 0.103601 1492.49s 1.5625e-05 +539 0.106381 0.103652 1492.81s 1.5625e-05 +540 0.106469 0.103654 1494.05s 1.5625e-05 +541 0.10634 0.103601 1493.28s 1.5625e-05 +542 0.106318 0.103577 1492.96s 1.5625e-05 +543 0.106394 0.103541 1493.6s 1.5625e-05 +544 0.106333 0.103608 1493.18s 1.5625e-05 +545 0.106297 0.103566 1493.64s 1.5625e-05 +546 0.106365 0.103517 1493.61s 1.5625e-05 +547 0.106266 0.103603 1491s 1.5625e-05 +548 0.106361 0.103583 1493.37s 1.5625e-05 +549 0.106352 0.103685 1493.33s 1.5625e-05 +550 0.106344 0.103594 1492.59s 1.5625e-05 +551 0.106291 0.103651 1492.35s 1.5625e-05 +552 0.106363 0.103582 1493.17s 1.5625e-05 +553 0.106303 0.103516 1492.45s 1.5625e-05 +554 0.106314 0.103573 1495.63s 1.5625e-05 +555 0.106258 0.103583 1494.99s 1.5625e-05 +556 0.106308 0.103555 1492.49s 1.5625e-05 +557 0.106344 0.103606 1491.25s 1.5625e-05 +558 0.106348 0.103655 2201.03s 1.5625e-05 +559 0.10629 0.103501 2185.56s 1.5625e-05 +560 0.106353 0.103557 2204.2s 1.5625e-05 +561 0.106194 0.10355 2184.4s 1.5625e-05 +562 0.106288 0.103607 1674.31s 1.5625e-05 +563 0.106286 0.103483 1493.16s 1.5625e-05 +564 0.106235 0.103512 1493.62s 1.5625e-05 +565 0.10627 0.103561 1493.3s 1.5625e-05 +566 0.106262 0.103568 1494.86s 1.5625e-05 +567 0.106312 0.103501 1494.14s 1.5625e-05 +568 0.106264 0.103464 1493.01s 1.5625e-05 +569 0.106342 0.103687 1492.4s 1.5625e-05 +570 0.10631 0.10354 1495s 1.5625e-05 +571 0.106239 0.103551 2279.25s 1.5625e-05 +572 0.106365 0.10351 2287.11s 1.5625e-05 +573 0.106241 0.103618 1605.59s 1.5625e-05 +574 0.106231 0.103486 1493.65s 1.5625e-05 +575 0.106262 0.103491 1494.03s 1.5625e-05 +576 0.106268 0.103588 1494.07s 1.5625e-05 +577 0.106215 0.10352 1496.72s 1.5625e-05 +578 0.106223 0.103563 1522.53s 1.5625e-05 +579 0.106265 0.103493 1501.33s 1.5625e-05 +580 0.106197 0.10352 1507.37s 1.5625e-05 +581 0.106324 0.103544 1556.34s 1.5625e-05 +582 0.106396 0.103611 1495.72s 1.5625e-05 +583 0.106158 0.103489 1495.64s 1.5625e-05 +584 0.106244 0.103543 1493.92s 1.5625e-05 +585 0.106311 0.103564 1494.25s 1.5625e-05 +586 0.106225 0.103552 1492.23s 1.5625e-05 +587 0.106243 0.103578 1494.83s 1.5625e-05 +588 0.10632 0.103479 1494.15s 1.5625e-05 +589 0.106154 0.103525 1494.07s 1.5625e-05 +590 0.106287 0.103608 1494.64s 1.5625e-05 +591 0.106088 0.103485 1494.22s 1.5625e-05 +592 0.106269 0.103543 1494.92s 1.5625e-05 +593 0.106346 0.10352 1495.86s 1.5625e-05 +594 0.10621 0.10356 1493.33s 1.5625e-05 +595 0.106191 0.103516 1493.72s 1.5625e-05 +596 0.106306 0.103494 1490.81s 1.5625e-05 +597 0.106241 0.10352 1492.31s 1.5625e-05 +598 0.106243 0.103478 1493.18s 1.5625e-05 +599 0.106323 0.103525 1492.49s 1.5625e-05 +600 0.106154 0.103512 1493.42s 1.5625e-05 +601 0.10621 0.103527 1494.31s 1.5625e-05 +602 0.106235 0.103588 1492.97s 1.5625e-05 +603 0.106189 0.103574 1495.09s 1.5625e-05 +604 0.106221 0.103428 1494.85s 1.5625e-05 +605 0.106256 0.103501 1492.35s 1.5625e-05 +606 0.106253 0.103528 1493.46s 1.5625e-05 +607 0.106191 0.103527 1491.5s 1.5625e-05 +608 0.106232 0.103463 1489.4s 1.5625e-05 +609 0.106282 0.103471 1491.98s 1.5625e-05 +610 0.106254 0.103475 1493.36s 1.5625e-05 +611 0.106217 0.103454 1491.06s 1.5625e-05 +612 0.106254 0.103518 1492.45s 1.5625e-05 +613 0.106088 0.103439 1491.51s 7.8125e-06 +614 0.106178 0.10339 1493.34s 7.8125e-06 +615 0.10611 0.103341 1492.57s 7.8125e-06 +616 0.106104 0.103333 1490.07s 7.8125e-06 +617 0.106109 0.103356 1491.25s 7.8125e-06 +618 0.106143 0.103367 1490.24s 7.8125e-06 +619 0.106152 0.103296 1488.38s 7.8125e-06 +620 0.106071 0.103341 1491.42s 7.8125e-06 +621 0.106037 0.103347 1493.45s 7.8125e-06 +622 0.106049 0.103327 1491.7s 7.8125e-06 +623 0.106007 0.103329 1492.48s 7.8125e-06 +624 0.106013 0.103344 1494.12s 7.8125e-06 +625 0.106107 0.103306 1494.12s 7.8125e-06 +626 0.106012 0.10331 1492.15s 7.8125e-06 +627 0.106058 0.103311 1492.47s 7.8125e-06 +628 0.106027 0.103312 1488.93s 7.8125e-06 +629 0.106117 0.103319 1491.27s 7.8125e-06 +630 0.106015 0.10333 1492.39s 7.8125e-06 +631 0.10604 0.103325 1489.84s 7.8125e-06 +632 0.106023 0.103318 1493.96s 7.8125e-06 +633 0.106062 0.103311 1493.83s 7.8125e-06 +634 0.10609 0.103342 1493.15s 7.8125e-06 +635 0.106057 0.103306 1502.22s 7.8125e-06 +636 0.106029 0.103366 1498.53s 7.8125e-06 +637 0.106089 0.103349 1505.9s 7.8125e-06 +638 0.106076 0.103369 1510.55s 7.8125e-06 +639 0.10599 0.103295 1495.98s 7.8125e-06 +640 0.106003 0.103304 1492.15s 7.8125e-06 +641 0.106085 0.103328 1491.25s 7.8125e-06 +642 0.106044 0.103388 1492.92s 7.8125e-06 +643 0.106039 0.103319 1493.66s 7.8125e-06 +644 0.106088 0.103293 1494.08s 7.8125e-06 +645 0.106124 0.103361 1493.59s 7.8125e-06 +646 0.105955 0.103311 1493.86s 7.8125e-06 +647 0.106018 0.103296 1492.95s 7.8125e-06 +648 0.106086 0.103336 1493.53s 7.8125e-06 +649 0.106022 0.103338 1494.82s 7.8125e-06 +650 0.106079 0.103298 1492.32s 7.8125e-06 +651 0.106082 0.103305 1492.85s 7.8125e-06 +652 0.10602 0.10335 1492.09s 7.8125e-06 +653 0.106017 0.103305 1493s 7.8125e-06 +654 0.106062 0.10331 1493.94s 7.8125e-06 +655 0.106031 0.103324 1493.39s 7.8125e-06 +656 0.106116 0.103256 1492.42s 7.8125e-06 +657 0.106005 0.103294 1494.35s 7.8125e-06 +658 0.10606 0.103295 1492.38s 7.8125e-06 +659 0.105998 0.103344 1493.49s 7.8125e-06 +660 0.106028 0.103277 1492.85s 7.8125e-06 +661 0.106046 0.103306 1491.24s 7.8125e-06 +662 0.105988 0.103315 1490.09s 7.8125e-06 +663 0.106033 0.103321 1491.08s 7.8125e-06 +664 0.106011 0.103289 1491.7s 7.8125e-06 +665 0.105977 0.103265 1492.04s 7.8125e-06 +666 0.106111 0.103273 1493.7s 7.8125e-06 +667 0.106016 0.103314 1492.37s 7.8125e-06 +668 0.106013 0.103312 1492.44s 7.8125e-06 +669 0.106003 0.103273 1492.69s 7.8125e-06 +670 0.10603 0.103322 1492.3s 7.8125e-06 +671 0.106014 0.103311 1491.29s 7.8125e-06 +672 0.106005 0.103295 1490.59s 7.8125e-06 +673 0.106033 0.103244 1489.06s 7.8125e-06 +674 0.105976 0.103268 1489.36s 7.8125e-06 +675 0.106006 0.103287 1492.61s 7.8125e-06 +676 0.105977 0.103276 1491.6s 7.8125e-06 +677 0.106032 0.103294 1492.94s 7.8125e-06 +678 0.105999 0.103298 1490.07s 7.8125e-06 +679 0.105949 0.103284 1492.85s 7.8125e-06 +680 0.105993 0.103285 1492.1s 7.8125e-06 +681 0.105949 0.103243 1492.16s 7.8125e-06 +682 0.106028 0.103324 1493s 7.8125e-06 +683 0.106069 0.103296 1494.28s 7.8125e-06 +684 0.106032 0.103272 1490.48s 7.8125e-06 +685 0.106089 0.103275 1491.5s 7.8125e-06 +686 0.106018 0.103277 1492.12s 7.8125e-06 +687 0.105991 0.103293 1492.43s 7.8125e-06 +688 0.105935 0.103254 1492.97s 7.8125e-06 +689 0.106054 0.103243 1495.01s 7.8125e-06 +690 0.105903 0.103307 1493.26s 7.8125e-06 +691 0.105988 0.103308 1494.51s 7.8125e-06 +692 0.106055 0.103297 1494.53s 7.8125e-06 +693 0.105932 0.103304 1504.68s 7.8125e-06 +694 0.105965 0.103301 1492.15s 7.8125e-06 +695 0.106013 0.103258 1496.99s 7.8125e-06 +696 0.105975 0.10325 1498.67s 7.8125e-06 +697 0.105961 0.103316 1521.74s 7.8125e-06 +698 0.105966 0.103234 1492.7s 3.90625e-06 +699 0.105935 0.103245 1493.51s 3.90625e-06 +700 0.105936 0.10323 1491.77s 3.90625e-06 +701 0.105851 0.103203 1494.66s 3.90625e-06 +702 0.105898 0.103215 1493.17s 3.90625e-06 +703 0.105891 0.103217 1493.2s 3.90625e-06 +704 0.105839 0.103203 1493.28s 3.90625e-06 +705 0.105995 0.103242 1492.89s 3.90625e-06 +706 0.105866 0.103212 1490.63s 3.90625e-06 +707 0.105856 0.10319 1490.94s 3.90625e-06 +708 0.105915 0.103227 1491.95s 3.90625e-06 +709 0.105984 0.103194 1491.52s 3.90625e-06 +710 0.105847 0.103198 1492.8s 3.90625e-06 +711 0.105972 0.10322 1493.89s 3.90625e-06 +712 0.105924 0.103217 1492.4s 3.90625e-06 +713 0.10588 0.103218 1492.5s 3.90625e-06 +714 0.105872 0.103166 1491.21s 3.90625e-06 +715 0.105954 0.103212 1493.59s 3.90625e-06 +716 0.105857 0.1032 1495.32s 3.90625e-06 +717 0.105919 0.103185 1491.94s 3.90625e-06 +718 0.105925 0.103188 1490.35s 3.90625e-06 +719 0.105959 0.103199 1491.9s 3.90625e-06 +720 0.1059 0.103203 1491.38s 3.90625e-06 +721 0.105896 0.103219 1492.94s 3.90625e-06 +722 0.105912 0.103205 1491.51s 3.90625e-06 +723 0.105865 0.103256 1491.77s 3.90625e-06 +724 0.105815 0.10318 1752.79s 3.90625e-06 +725 0.105838 0.103172 1712.61s 3.90625e-06 +726 0.105949 0.103194 1493.86s 3.90625e-06 +727 0.10589 0.103199 1492.65s 3.90625e-06 +728 0.105835 0.103166 1489.55s 3.90625e-06 +729 0.105905 0.103213 1490.72s 3.90625e-06 +730 0.105927 0.103223 1493.3s 3.90625e-06 +731 0.105852 0.103178 1492.59s 3.90625e-06 +732 0.105891 0.103209 1492.55s 3.90625e-06 +733 0.105853 0.103168 1493.55s 3.90625e-06 +734 0.10592 0.103222 1492.23s 3.90625e-06 +735 0.105904 0.103172 1494.03s 3.90625e-06 +736 0.105769 0.10319 1494.74s 3.90625e-06 +737 0.105901 0.103172 1493.47s 3.90625e-06 +738 0.105828 0.103171 1491.74s 3.90625e-06 +739 0.10593 0.103181 1492.03s 3.90625e-06 +740 0.105915 0.103192 1493.09s 3.90625e-06 +741 0.106014 0.103178 1492.76s 3.90625e-06 +742 0.105963 0.103191 1492.11s 3.90625e-06 +743 0.105856 0.103191 1490.46s 3.90625e-06 +744 0.105851 0.103189 1495.5s 3.90625e-06 +745 0.105876 0.103167 1492.37s 3.90625e-06 +746 0.105948 0.103189 1492.66s 3.90625e-06 +747 0.105921 0.10317 1491.1s 3.90625e-06 +748 0.10588 0.103158 1707.14s 3.90625e-06 +749 0.105854 0.103194 1525.12s 3.90625e-06 +750 0.105913 0.103191 1507.14s 3.90625e-06 +751 0.105738 0.103164 1490.21s 3.90625e-06 +752 0.105879 0.103178 1524.95s 3.90625e-06 +753 0.105803 0.10317 1514.14s 3.90625e-06 +754 0.105915 0.103188 1500.07s 3.90625e-06 +755 0.105871 0.103184 1540.36s 3.90625e-06 +756 0.105836 0.103156 1493.66s 3.90625e-06 +757 0.105845 0.103167 1493.96s 3.90625e-06 +758 0.105898 0.103187 1491.56s 3.90625e-06 +759 0.105852 0.1032 1491.87s 3.90625e-06 +760 0.105871 0.103173 1492.52s 3.90625e-06 +761 0.10584 0.103184 1493.62s 3.90625e-06 +762 0.105897 0.103188 1491.55s 3.90625e-06 +763 0.105786 0.103161 1490.77s 3.90625e-06 +764 0.105853 0.103179 1492.23s 3.90625e-06 +765 0.105834 0.103149 1493.14s 3.90625e-06 +766 0.105845 0.103201 1492.92s 3.90625e-06 +767 0.105894 0.103153 1492.35s 3.90625e-06 +768 0.105857 0.103164 1491.7s 3.90625e-06 +769 0.105867 0.10318 1492.81s 3.90625e-06 +770 0.105929 0.103203 1494s 3.90625e-06 +771 0.105858 0.103161 1491.65s 3.90625e-06 +772 0.105888 0.103155 1491.1s 3.90625e-06 +773 0.105965 0.103177 1491.61s 3.90625e-06 +774 0.105817 0.103202 1491.18s 3.90625e-06 +775 0.105919 0.103193 1489.87s 3.90625e-06 +776 0.105819 0.103175 1491.99s 3.90625e-06 +777 0.105845 0.103161 1493.98s 3.90625e-06 +778 0.105826 0.103146 1493.14s 3.90625e-06 +779 0.105838 0.103175 1493.44s 3.90625e-06 +780 0.105828 0.103194 1495.05s 3.90625e-06 +781 0.10592 0.10317 1492.88s 3.90625e-06 +782 0.105815 0.103187 1492.69s 3.90625e-06 +783 0.105856 0.103157 1493.5s 3.90625e-06 +784 0.105861 0.103122 1491.33s 1.95313e-06 +785 0.105828 0.103184 2176.53s 1.95313e-06 +786 0.105744 0.103137 1490.16s 1.95313e-06 +787 0.105869 0.103134 1490.4s 1.95313e-06 +788 0.105822 0.103146 1492.87s 1.95313e-06 +789 0.105804 0.103144 1491.38s 1.95313e-06 +790 0.105853 0.103153 1493.32s 1.95313e-06 +791 0.10581 0.103157 1493.42s 1.95313e-06 +792 0.105843 0.10316 1492.46s 1.95313e-06 +793 0.105897 0.103121 1493.07s 1.95313e-06 +794 0.105823 0.103146 1492.95s 1.95313e-06 +795 0.105866 0.103139 1495.11s 1.95313e-06 +796 0.105859 0.103172 1491.66s 1.95313e-06 +797 0.105858 0.103134 1493.47s 1.95313e-06 +798 0.105746 0.103121 1490.32s 1.95313e-06 +799 0.105815 0.103119 1492.94s 1.95313e-06 +800 0.1058 0.103144 1492.27s 1.95313e-06 +801 0.105829 0.103126 1492.32s 1.95313e-06 +802 0.105921 0.103149 1493.71s 1.95313e-06 +803 0.105728 0.103136 1494.61s 1.95313e-06 +804 0.10582 0.103138 1494.51s 1.95313e-06 +805 0.105841 0.103141 1491.96s 1.95313e-06 +806 0.105745 0.103143 1677.74s 1.95313e-06 +807 0.105712 0.103136 1495.36s 1.95313e-06 +808 0.105816 0.103135 1622.93s 1.95313e-06 +809 0.105803 0.103131 1557.93s 1.95313e-06 +810 0.105863 0.103137 1509.9s 1.95313e-06 +811 0.105767 0.103114 1505.48s 1.95313e-06 +812 0.105803 0.103151 1502.35s 1.95313e-06 +813 0.105827 0.103107 1557.17s 1.95313e-06 +814 0.105855 0.103134 1493.01s 1.95313e-06 +815 0.105801 0.103127 1492.08s 1.95313e-06 +816 0.105831 0.103111 1493.8s 1.95313e-06 +817 0.105789 0.103135 1494.7s 1.95313e-06 +818 0.105809 0.103126 1494.99s 1.95313e-06 +819 0.105785 0.103113 1494.66s 1.95313e-06 +820 0.105877 0.103129 1494.11s 1.95313e-06 +821 0.105847 0.103123 1491.73s 1.95313e-06 +822 0.105835 0.103114 1492.35s 1.95313e-06 +823 0.105865 0.10313 1491.03s 1.95313e-06 +824 0.105738 0.10311 1491.55s 1.95313e-06 +825 0.105877 0.103137 1492.84s 1.95313e-06 +826 0.105792 0.103107 1491.57s 1.95313e-06 +827 0.105885 0.10312 1493.49s 1.95313e-06 +828 0.10576 0.103126 1718.45s 1.95313e-06 +829 0.105836 0.103118 2075.16s 1.95313e-06 +830 0.105771 0.103106 1494.34s 1.95313e-06 +831 0.105772 0.103086 1494.14s 1.95313e-06 +832 0.105779 0.103125 1493.01s 1.95313e-06 +833 0.105753 0.103114 1491.34s 1.95313e-06 +834 0.105749 0.103118 1492.66s 1.95313e-06 +835 0.105758 0.103106 1491.7s 1.95313e-06 +836 0.105812 0.103119 1490.82s 1.95313e-06 +837 0.105805 0.103125 1494.54s 1.95313e-06 +838 0.105826 0.103107 1493.67s 1.95313e-06 +839 0.105826 0.103117 1491.01s 1.95313e-06 +840 0.105772 0.103112 1493.34s 1.95313e-06 +841 0.105922 0.103135 1492.53s 1.95313e-06 +842 0.105882 0.103135 1492.71s 1.95313e-06 +843 0.105738 0.103104 1491.98s 1.95313e-06 +844 0.105791 0.103104 1490.57s 1.95313e-06 +845 0.105909 0.103112 1493.44s 1.95313e-06 +846 0.105708 0.103106 1490.73s 1.95313e-06 +847 0.10584 0.103121 1491.97s 1.95313e-06 +848 0.105749 0.103126 1490.9s 1.95313e-06 +849 0.105747 0.10314 1491.99s 1.95313e-06 +850 0.105711 0.10311 1494.01s 1.95313e-06 +851 0.105747 0.103102 1493.96s 1.95313e-06 +852 0.105697 0.103108 1494.42s 1.95313e-06 +853 0.105775 0.103122 1493.49s 1.95313e-06 +854 0.105859 0.10312 1492.72s 1.95313e-06 +855 0.105849 0.103106 1492.82s 1.95313e-06 +856 0.105831 0.103105 1491.84s 1.95313e-06 +857 0.105753 0.103129 1489.73s 1.95313e-06 +858 0.105871 0.103113 1491.16s 1.95313e-06 +859 0.105821 0.103111 1491.39s 1.95313e-06 +860 0.105828 0.103117 1493.44s 1.95313e-06 +861 0.105797 0.103112 1491.6s 1.95313e-06 +862 0.105834 0.103114 1492.16s 1.95313e-06 +863 0.105726 0.103125 1493.64s 1.95313e-06 +864 0.105703 0.103126 1718.99s 1.95313e-06 +865 0.105824 0.103114 1808.25s 1.95313e-06 +866 0.105756 0.103112 1493.43s 1.95313e-06 +867 0.105837 0.103115 1536.93s 9.76563e-07 +868 0.105812 0.103095 1490.97s 9.76563e-07 +869 0.105748 0.103107 1595.3s 9.76563e-07 +870 0.105795 0.103126 1527.16s 9.76563e-07 +871 0.105767 0.103108 1493.01s 9.76563e-07 +872 0.105711 0.103113 1492.88s 9.76563e-07 +873 0.105826 0.103102 1491.39s 9.76563e-07 +874 0.105806 0.103106 1493.28s 9.76563e-07 +875 0.105719 0.103113 1492.01s 9.76563e-07 +876 0.10577 0.103131 1492.67s 9.76563e-07 +877 0.105795 0.103106 1493.33s 9.76563e-07 +878 0.105785 0.103121 1493.92s 9.76563e-07 +879 0.1058 0.103106 1492.53s 9.76563e-07 +880 0.105859 0.103097 1494.11s 9.76563e-07 +881 0.105728 0.103114 1490.38s 9.76563e-07 +882 0.10575 0.103106 1491.6s 9.76563e-07 +883 0.105791 0.10311 1491.93s 9.76563e-07 +884 0.105701 0.103108 1491.44s 9.76563e-07 +885 0.105728 0.103091 1918.71s 9.76563e-07 +886 0.105783 0.10312 1889.43s 9.76563e-07 +887 0.105755 0.103115 1494.09s 9.76563e-07 +888 0.105797 0.103099 1493.46s 9.76563e-07 +889 0.105781 0.103131 1494.37s 9.76563e-07 +890 0.10572 0.103103 1588.65s 9.76563e-07 +891 0.105844 0.10311 2286.77s 9.76563e-07 +892 0.105721 0.1031 2284.5s 9.76563e-07 +893 0.105803 0.103089 2280.59s 9.76563e-07 +894 0.105717 0.10312 2257.01s 9.76563e-07 +895 0.105813 0.103118 1501.79s 9.76563e-07 +896 0.105684 0.103101 1492.44s 9.76563e-07 +897 0.105784 0.103113 1493.13s 9.76563e-07 +898 0.105705 0.103102 1491.79s 9.76563e-07 +899 0.105753 0.103089 1494.64s 9.76563e-07 +900 0.10574 0.103108 1493.86s 9.76563e-07 +901 0.10577 0.1031 1495.41s 9.76563e-07 +902 0.105798 0.103109 1493.56s 9.76563e-07 +903 0.105723 0.103107 1493.38s 9.76563e-07 +904 0.105818 0.103106 1493.64s 9.76563e-07 +905 0.105728 0.103103 1493.96s 9.76563e-07 +906 0.105768 0.1031 1493.05s 9.76563e-07 +907 0.105762 0.103113 1490.6s 9.76563e-07 +908 0.105817 0.103103 1493.32s 9.76563e-07 +909 0.105785 0.103113 1494.89s 9.76563e-07 +910 0.105795 0.103105 1494.07s 9.76563e-07 +911 0.105736 0.103105 1494.06s 9.76563e-07 +912 0.10572 0.103103 1493.93s 9.76563e-07 +913 0.105774 0.103115 1494.42s 9.76563e-07 +914 0.105701 0.103101 1494.94s 9.76563e-07 +915 0.10577 0.103105 1494.41s 9.76563e-07 +916 0.105774 0.103096 1491.28s 9.76563e-07 +917 0.105701 0.103081 1492.4s 9.76563e-07 +918 0.105733 0.103109 1491.19s 9.76563e-07 +919 0.105718 0.103088 1712.07s 9.76563e-07 +920 0.10577 0.103075 1532.37s 9.76563e-07 +921 0.105714 0.103098 1562.25s 9.76563e-07 +922 0.105811 0.103079 1616s 9.76563e-07 +923 0.105719 0.103101 1509.31s 9.76563e-07 +924 0.105752 0.103103 1543.86s 9.76563e-07 +925 0.105731 0.103084 1514.06s 9.76563e-07 +926 0.1058 0.10308 1600.44s 9.76563e-07 +927 0.105762 0.103092 1684.27s 9.76563e-07 +928 0.105732 0.1031 1492.41s 9.76563e-07 +929 0.105726 0.10309 2208.59s 9.76563e-07 +930 0.105719 0.103097 1492.17s 9.76563e-07 +931 0.105766 0.1031 1491.18s 9.76563e-07 +932 0.105769 0.103099 1492.9s 9.76563e-07 +933 0.105807 0.103084 1493.82s 9.76563e-07 +934 0.105816 0.103098 1495.58s 9.76563e-07 +935 0.105701 0.103086 1494.78s 9.76563e-07 +936 0.105736 0.103088 1492.02s 9.76563e-07 +937 0.10576 0.103091 1494.43s 9.76563e-07 +938 0.105732 0.103093 1495.67s 9.76563e-07 +939 0.105754 0.103073 1493.88s 9.76563e-07 +940 0.105785 0.103098 2304.34s 9.76563e-07 +941 0.105684 0.10308 2288.29s 9.76563e-07 +942 0.105614 0.103079 1492.88s 9.76563e-07 +943 0.105673 0.1031 1492.18s 9.76563e-07 +944 0.105713 0.10308 1494.24s 9.76563e-07 +945 0.105686 0.103078 1493.06s 4.88281e-07 +946 0.105728 0.103074 1493.46s 4.88281e-07 +947 0.105694 0.10309 1495.28s 4.88281e-07 +948 0.105701 0.103087 1494.6s 4.88281e-07 +949 0.10566 0.103086 1493.8s 4.88281e-07 +950 0.1057 0.103085 1494.22s 4.88281e-07 +951 0.105686 0.103079 1495.5s 4.88281e-07 +952 0.105786 0.103074 1494.01s 4.88281e-07 +953 0.105755 0.103084 1493.12s 4.88281e-07 +954 0.105734 0.103064 1493.18s 4.88281e-07 +955 0.10579 0.103088 1493.31s 4.88281e-07 +956 0.105793 0.103091 1491.04s 4.88281e-07 +957 0.105825 0.103081 1493.16s 4.88281e-07 +958 0.10563 0.103087 1492.84s 4.88281e-07 +959 0.105717 0.103083 1494.67s 4.88281e-07 +960 0.105803 0.103082 1495.32s 4.88281e-07 +961 0.105745 0.103077 1493.98s 4.88281e-07 +962 0.105825 0.103078 1494.84s 4.88281e-07 +963 0.105646 0.103072 1495.5s 4.88281e-07 +964 0.105704 0.103095 1491.37s 4.88281e-07 +965 0.105663 0.103082 1491.67s 4.88281e-07 +966 0.10571 0.103083 1493.37s 4.88281e-07 +967 0.10571 0.103067 1492.56s 4.88281e-07 +968 0.105799 0.103098 1495.86s 4.88281e-07 +969 0.105768 0.103064 1495s 4.88281e-07 +970 0.105767 0.103074 1493.48s 4.88281e-07 +971 0.105773 0.103075 1494.41s 4.88281e-07 +972 0.105704 0.103101 1493.47s 4.88281e-07 +973 0.105793 0.103085 1493.89s 4.88281e-07 +974 0.105729 0.103091 1492.29s 4.88281e-07 +975 0.105809 0.103088 1491.19s 4.88281e-07 +976 0.105779 0.10309 1687.22s 4.88281e-07 +977 0.10573 0.103073 1890.99s 4.88281e-07 +978 0.105786 0.103085 1630.15s 4.88281e-07 +979 0.105719 0.103086 1538.25s 4.88281e-07 +980 0.105828 0.10308 1492.94s 4.88281e-07 +981 0.105698 0.10306 1516.23s 4.88281e-07 +982 0.105731 0.103081 1493.68s 4.88281e-07 +983 0.10573 0.103063 1493.36s 4.88281e-07 +984 0.105724 0.10308 1494.18s 4.88281e-07 +985 0.105719 0.103095 1495.64s 4.88281e-07 +986 0.105712 0.103086 1493.75s 4.88281e-07 +987 0.105768 0.103072 1492s 4.88281e-07 +988 0.10576 0.10308 1492.01s 4.88281e-07 +989 0.105773 0.103087 1490.8s 4.88281e-07 +990 0.105715 0.10309 1493.79s 4.88281e-07 +991 0.10584 0.103092 1493.98s 4.88281e-07 +992 0.105738 0.103071 1491.04s 4.88281e-07 +993 0.105669 0.103101 1492.29s 4.88281e-07 +994 0.10578 0.103089 1492.84s 4.88281e-07 +995 0.105764 0.103088 1492.25s 4.88281e-07 +996 0.10579 0.103078 1492.99s 4.88281e-07 +997 0.105796 0.103084 1491.38s 4.88281e-07 +998 0.105738 0.103082 1490.84s 4.88281e-07 +999 0.105829 0.103084 1488.34s 4.88281e-07 +1000 0.105722 0.103086 1489.04s 4.88281e-07 +1001 0.105634 0.10308 1492.7s 4.88281e-07 +1002 0.105699 0.103075 1490.97s 4.88281e-07 +1003 0.105698 0.103073 1491.45s 4.88281e-07 +1004 0.105797 0.103073 1492.68s 4.88281e-07 diff --git a/apollo/common/checkers/__init__.py b/apollo/engine/genre_classification/__init__.py similarity index 100% rename from apollo/common/checkers/__init__.py rename to apollo/engine/genre_classification/__init__.py diff --git a/apollo/engine/genre_classification/configuration.py b/apollo/engine/genre_classification/configuration.py new file mode 100644 index 00000000..64ca6e5c --- /dev/null +++ b/apollo/engine/genre_classification/configuration.py @@ -0,0 +1,16 @@ +# Signal processing setup +SR = 16000 +FFT_HOP = 256 +FFT_SIZE = 512 +N_MELS = 96 + +# Machine learning setup +BATCH_SIZE = 1 # (size of the batch during prediction) + +# Output labels +MSD_LABELS = ['rock', 'pop', 'alternative', 'indie', 'electronic', 'female vocalists', 'dance', '00s', + 'alternative rock', 'jazz', 'beautiful', 'metal', 'chillout', 'male vocalists', 'classic rock', 'soul', + 'indie rock', 'Mellow', 'electronica', '80s', 'folk', '90s', 'chill', 'instrumental', 'punk', 'oldies', + 'blues', 'hard rock', 'ambient', 'acoustic', 'experimental', 'female vocalist', 'guitar', 'Hip-Hop', + '70s', 'party', 'country', 'easy listening', 'sexy', 'catchy', 'funk', 'electro', 'heavy metal', + 'Progressive rock', '60s', 'r n b', 'indie pop', 'sad', 'House', 'happy'] diff --git a/apollo/engine/genre_classification/extractor.py b/apollo/engine/genre_classification/extractor.py new file mode 100644 index 00000000..3b0ef952 --- /dev/null +++ b/apollo/engine/genre_classification/extractor.py @@ -0,0 +1,188 @@ +import os + +import librosa +import matplotlib as plt +import numpy as np +import tensorflow as tf +from matplotlib.figure import Figure + +from apollo.engine.genre_classification import configuration as config +from apollo.engine.genre_classification import models + +# disable eager mode for tf.v1 compatibility with tf.v2 +tf.compat.v1.disable_eager_execution() + + +def batch_data(audio_file, n_frames, overlap): + # compute the log-mel spectrogram with librosa + audio, sr = librosa.load(audio_file, sr=config.SR) + audio_rep = librosa.feature.melspectrogram(y=audio, + sr=sr, + hop_length=config.FFT_HOP, + n_fft=config.FFT_SIZE, + n_mels=config.N_MELS).T + audio_rep = audio_rep.astype(np.float16) + audio_rep = np.log10(10000 * audio_rep + 1) + + # batch it for an efficient computing + first = True + last_frame = audio_rep.shape[0] - n_frames + 1 + # +1 is to include the last frame that range would not include + for time_stamp in range(0, last_frame, overlap): + patch = np.expand_dims(audio_rep[time_stamp: time_stamp + n_frames, :], axis=0) + if first: + batch = patch + first = False + else: + batch = np.concatenate((batch, patch), axis=0) + + return batch, audio_rep + + +def extractor(file_name, output_folder, model='MSD_musicnn', input_length=3, input_overlap=False, + extract_features=True): + # select model + labels = config.MSD_LABELS + num_classes = len(labels) + + # convert seconds to frames + n_frames = librosa.time_to_frames(input_length, sr=config.SR, n_fft=config.FFT_SIZE, hop_length=config.FFT_HOP) + 1 + if not input_overlap: + overlap = n_frames + else: + overlap = librosa.time_to_frames(input_overlap, sr=config.SR, n_fft=config.FFT_SIZE, hop_length=config.FFT_HOP) + + # tensorflow: define the model + tf.compat.v1.reset_default_graph() + with tf.name_scope('model'): + x = tf.compat.v1.placeholder(tf.float32, [None, n_frames, config.N_MELS]) + is_training = tf.compat.v1.placeholder(tf.bool) + y, timbral, temporal, cnn1, cnn2, cnn3, mean_pool, max_pool, penultimate = models.define_model(x, + is_training, + model, + num_classes) + normalized_y = tf.nn.sigmoid(y) + + # tensorflow: loading model + sess = tf.compat.v1.Session() + sess.run(tf.compat.v1.global_variables_initializer()) + saver = tf.compat.v1.train.Saver() + saver.restore(sess, os.path.dirname(__file__) + '/' + model + '/') + + # batching data + print('Computing spectrogram (w/ librosa) and tags (w/ tensorflow)..', end=" ") + batch, spectrogram = batch_data(file_name, n_frames, overlap) + + # tensorflow: extract features and tags + # ..first batch! + if extract_features: + extract_vector = [normalized_y, timbral, temporal, cnn1, cnn2, cnn3, mean_pool, max_pool, penultimate] + else: + extract_vector = [normalized_y] + + tf_out = sess.run(extract_vector, + feed_dict={x: batch[:config.BATCH_SIZE], + is_training: False}) + + if extract_features: + predicted_tags, timbral_, temporal_, cnn1_, cnn2_, cnn3_, mean_pool_, max_pool_, penultimate_ = tf_out + features = dict() + features['timbral'] = np.squeeze(timbral_) + features['temporal'] = np.squeeze(temporal_) + features['cnn1'] = np.squeeze(cnn1_) + features['cnn2'] = np.squeeze(cnn2_) + features['cnn3'] = np.squeeze(cnn3_) + features['mean_pool'] = mean_pool_ + features['max_pool'] = max_pool_ + features['penultimate'] = penultimate_ + else: + predicted_tags = tf_out[0] + + taggram = np.array(predicted_tags) + + # ..rest of the batches! + for id_pointer in range(config.BATCH_SIZE, batch.shape[0], config.BATCH_SIZE): + + tf_out = sess.run(extract_vector, + feed_dict={x: batch[id_pointer:id_pointer + config.BATCH_SIZE], + is_training: False}) + + if extract_features: + predicted_tags, timbral_, temporal_, midend1_, midend2_, midend3_, mean_pool_, max_pool_, penultimate_ = tf_out + features['timbral'] = np.concatenate((features['timbral'], np.squeeze(timbral_)), axis=0) + features['temporal'] = np.concatenate((features['temporal'], np.squeeze(temporal_)), axis=0) + features['cnn1'] = np.concatenate((features['cnn1'], np.squeeze(cnn1_)), axis=0) + features['cnn2'] = np.concatenate((features['cnn2'], np.squeeze(cnn2_)), axis=0) + features['cnn3'] = np.concatenate((features['cnn3'], np.squeeze(cnn3_)), axis=0) + features['mean_pool'] = np.concatenate((features['mean_pool'], mean_pool_), axis=0) + features['max_pool'] = np.concatenate((features['max_pool'], max_pool_), axis=0) + features['penultimate'] = np.concatenate((features['penultimate'], penultimate_), axis=0) + else: + predicted_tags = tf_out[0] + + taggram = np.concatenate((taggram, np.array(predicted_tags)), axis=0) + + sess.close() + + plotter(input_length, taggram, labels, output_folder, file_name) + + +def plotter(input_length, taggram, tags, output_folder, file_name): + plt.rcParams['text.color'] = 'white' + fontsize = 12 # set figures font size + + # Plot Taggram for the labels + fig = Figure(figsize=(60, 15)) + ax = fig.subplots() + ax.set_xlabel('(seconds)', fontsize=fontsize) + # y-axis + y_pos = np.arange(len(tags)) + ax.set_yticks(y_pos) + ax.set_yticklabels(tags, fontsize=fontsize - 1) + # x-axis + x_pos = np.arange(taggram.shape[0]) + x_label = np.arange(input_length / 2, input_length * taggram.shape[0], 3) + ax.set_xticks(x_pos) + ax.set_xticklabels(x_label, fontsize=fontsize) + # depict taggram + ax.imshow(taggram.T, interpolation=None, aspect="auto") + fig.savefig(output_folder + "Taggram") + + # Plot Bar chart for the labels + fig = Figure(figsize=(10, 8)) + tags_likelihood_mean = np.mean(taggram, axis=0) # averaging the Taggram through time + tags_likelihood = tags_likelihood_mean / sum(tags_likelihood_mean) + ax = fig.subplots() + # y-axis title + ax.set_ylabel('(likelihood)', fontsize=fontsize) + # y-axis + ax.set_ylim((0, 1)) + ax.tick_params(axis="y", labelsize=fontsize) + # x-axis + ax.tick_params(axis="x", labelsize=fontsize - 1) + pos = np.arange(len(tags)) + ax.set_xticks(pos) + ax.set_xticklabels(tags, rotation=90) + # depict song-level tags likelihood + ax.bar(pos, tags_likelihood) + fig.savefig(output_folder + "Tags_Likelihood") + + # Plot Pie Chart + fig = Figure(figsize=(10, 8)) + fig.subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0) + tags_likelihood_mean = np.mean(taggram, axis=0) # averaging the Taggram through time + indices = np.where(tags_likelihood_mean >= 0.1)[0] + tags_likelihood_mean = tags_likelihood_mean[indices] + tags = list(np.array(tags)[indices.astype(int)]) + indices = np.argsort(-tags_likelihood_mean) + tags_likelihood_mean = tags_likelihood_mean[indices] + tags = list(np.array(tags)[indices.astype(int)]) + tags_likelihood_mean = tags_likelihood_mean / sum(tags_likelihood_mean) + explode = [0] * len(tags) + explode[0] = 0.2 + ax1 = fig.subplots() + ax1.pie(tags_likelihood_mean, explode=explode, labels=tags, autopct='%1.1f%%', + shadow=True, startangle=90, wedgeprops={}) + ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. + ax1.margins(0.1, 0.1) + fig.savefig(output_folder + "PieChart", transparent=True) diff --git a/apollo/engine/genre_classification/models.py b/apollo/engine/genre_classification/models.py new file mode 100644 index 00000000..46c5e819 --- /dev/null +++ b/apollo/engine/genre_classification/models.py @@ -0,0 +1,167 @@ +import tensorflow as tf + +from apollo.engine.genre_classification import configuration as config + +# disabling deprecation warnings (caused by change from tensorflow 1.x to 2.x) +tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) + + +def define_model(x, is_training, model, num_classes): + return build_musicnn(x, is_training, num_classes, num_filt_midend=64, num_units_backend=200) + + +def build_musicnn(x, is_training, num_classes, num_filt_frontend=1.6, num_filt_midend=64, num_units_backend=200): + # front-end, musically motivated CNN + frontend_features_list = frontend(x, is_training, config.N_MELS, num_filt=1.6, type='7774timbraltemporal') + # concatnate features coming from the front-end + frontend_features = tf.concat(frontend_features_list, 2) + + # mid-end, dense layers + midend_features_list = midend(frontend_features, is_training, num_filt_midend) + # dense connection: concatnate features coming from different layers of the front- and mid-end + midend_features = tf.concat(midend_features_list, 2) + + # back-end, temporal pooling + logits, penultimate, mean_pool, max_pool = backend(midend_features, is_training, num_classes, num_units_backend, + type='globalpool_dense') + + # [extract features] temporal and timbral features from the front-end + timbral = tf.concat([frontend_features_list[0], frontend_features_list[1]], 2) + temporal = tf.concat([frontend_features_list[2], frontend_features_list[3], frontend_features_list[4]], 2) + # [extract features] mid-end features + cnn1, cnn2, cnn3 = midend_features_list[1], midend_features_list[2], midend_features_list[3] + mean_pool = tf.squeeze(mean_pool, [2]) + max_pool = tf.squeeze(max_pool, [2]) + + return logits, timbral, temporal, cnn1, cnn2, cnn3, mean_pool, max_pool, penultimate + + +def frontend(x, is_training, yInput, num_filt, type): + expand_input = tf.expand_dims(x, 3) + normalized_input = tf.compat.v1.layers.batch_normalization(expand_input, training=is_training) + + if 'timbral' in type: + + # padding only time domain for an efficient 'same' implementation + # (since we pool throughout all frequency afterwards) + input_pad_7 = tf.pad(normalized_input, [[0, 0], [3, 3], [0, 0], [0, 0]], "CONSTANT") + + if '74' in type: + f74 = timbral_block(inputs=input_pad_7, + filters=int(num_filt * 128), + kernel_size=[7, int(0.4 * yInput)], + is_training=is_training) + + if '77' in type: + f77 = timbral_block(inputs=input_pad_7, + filters=int(num_filt * 128), + kernel_size=[7, int(0.7 * yInput)], + is_training=is_training) + + if 'temporal' in type: + s1 = tempo_block(inputs=normalized_input, + filters=int(num_filt * 32), + kernel_size=[128, 1], + is_training=is_training) + + s2 = tempo_block(inputs=normalized_input, + filters=int(num_filt * 32), + kernel_size=[64, 1], + is_training=is_training) + + s3 = tempo_block(inputs=normalized_input, + filters=int(num_filt * 32), + kernel_size=[32, 1], + is_training=is_training) + + # choose the feature maps we want to use for the experiment + if type == '7774timbraltemporal': + return [f74, f77, s1, s2, s3] + + +def timbral_block(inputs, filters, kernel_size, is_training, padding="valid", activation=tf.nn.relu): + conv = tf.compat.v1.layers.conv2d(inputs=inputs, + filters=filters, + kernel_size=kernel_size, + padding=padding, + activation=activation) + bn_conv = tf.compat.v1.layers.batch_normalization(conv, training=is_training) + pool = tf.compat.v1.layers.max_pooling2d(inputs=bn_conv, + pool_size=[1, bn_conv.shape[2]], + strides=[1, bn_conv.shape[2]]) + return tf.squeeze(pool, [2]) + + +def tempo_block(inputs, filters, kernel_size, is_training, padding="same", activation=tf.nn.relu): + conv = tf.compat.v1.layers.conv2d(inputs=inputs, + filters=filters, + kernel_size=kernel_size, + padding=padding, + activation=activation) + bn_conv = tf.compat.v1.layers.batch_normalization(conv, training=is_training) + pool = tf.compat.v1.layers.max_pooling2d(inputs=bn_conv, + pool_size=[1, bn_conv.shape[2]], + strides=[1, bn_conv.shape[2]]) + return tf.squeeze(pool, [2]) + + +def midend(front_end_output, is_training, num_filt): + front_end_output = tf.expand_dims(front_end_output, 3) + + # conv layer 1 - adapting dimensions + front_end_pad = tf.pad(front_end_output, [[0, 0], [3, 3], [0, 0], [0, 0]], "CONSTANT") + conv1 = tf.compat.v1.layers.conv2d(inputs=front_end_pad, + filters=num_filt, + kernel_size=[7, front_end_pad.shape[2]], + padding="valid", + activation=tf.nn.relu) + bn_conv1 = tf.compat.v1.layers.batch_normalization(conv1, training=is_training) + bn_conv1_t = tf.transpose(bn_conv1, [0, 1, 3, 2]) + + # conv layer 2 - residual connection + bn_conv1_pad = tf.pad(bn_conv1_t, [[0, 0], [3, 3], [0, 0], [0, 0]], "CONSTANT") + conv2 = tf.compat.v1.layers.conv2d(inputs=bn_conv1_pad, + filters=num_filt, + kernel_size=[7, bn_conv1_pad.shape[2]], + padding="valid", + activation=tf.nn.relu) + bn_conv2 = tf.compat.v1.layers.batch_normalization(conv2, training=is_training) + conv2 = tf.transpose(bn_conv2, [0, 1, 3, 2]) + res_conv2 = tf.add(conv2, bn_conv1_t) + + # conv layer 3 - residual connection + bn_conv2_pad = tf.pad(res_conv2, [[0, 0], [3, 3], [0, 0], [0, 0]], "CONSTANT") + conv3 = tf.compat.v1.layers.conv2d(inputs=bn_conv2_pad, + filters=num_filt, + kernel_size=[7, bn_conv2_pad.shape[2]], + padding="valid", + activation=tf.nn.relu) + bn_conv3 = tf.compat.v1.layers.batch_normalization(conv3, training=is_training) + conv3 = tf.transpose(bn_conv3, [0, 1, 3, 2]) + res_conv3 = tf.add(conv3, res_conv2) + + return [front_end_output, bn_conv1_t, res_conv2, res_conv3] + + +def backend(feature_map, is_training, num_classes, output_units, type): + # temporal pooling + max_pool = tf.reduce_max(feature_map, axis=1) + mean_pool, var_pool = tf.nn.moments(feature_map, axes=[1]) + tmp_pool = tf.concat([max_pool, mean_pool], 2) + + # penultimate dense layer + flat_pool = tf.compat.v1.layers.flatten(tmp_pool) + flat_pool = tf.compat.v1.layers.batch_normalization(flat_pool, training=is_training) + flat_pool_dropout = tf.compat.v1.layers.dropout(flat_pool, rate=0.5, training=is_training) + dense = tf.compat.v1.layers.dense(inputs=flat_pool_dropout, + units=output_units, + activation=tf.nn.relu) + bn_dense = tf.compat.v1.layers.batch_normalization(dense, training=is_training) + dense_dropout = tf.compat.v1.layers.dropout(bn_dense, rate=0.5, training=is_training) + + # output dense layer + logits = tf.compat.v1.layers.dense(inputs=dense_dropout, + activation=None, + units=num_classes) + + return logits, bn_dense, mean_pool, max_pool diff --git a/apollo/engine/genre_classification/tagger.py b/apollo/engine/genre_classification/tagger.py new file mode 100644 index 00000000..03502edc --- /dev/null +++ b/apollo/engine/genre_classification/tagger.py @@ -0,0 +1,99 @@ +import argparse + +import numpy as np + +from apollo.engine.genre_classification.extractor import extractor + + +def top_tags(file_name, model='MSD_musicnn', topN=5, input_length=10, input_overlap=False, print_tags=True, + save_tags=False): + taggram, tags = extractor(file_name, model=model, input_length=input_length, input_overlap=input_overlap, + extract_features=False) + tags_likelihood_mean = np.mean(taggram, axis=0) + + if print_tags: + print('[' + file_name + '] Top' + str(topN) + ' tags: ') + + if save_tags: + to = open(save_tags, 'a') + to.write( + file_name + ',' + model + ',input_length=' + str(input_length) + ',input_overlap=' + str(input_overlap)) + + topN_tags = [] + for tag_index in tags_likelihood_mean.argsort()[-topN:][::-1]: + topN_tags.append(tags[tag_index]) + + if print_tags: + print(' - ' + tags[tag_index]) + + if save_tags: + to.write(',' + tags[tag_index]) + + if save_tags: + to.write('\n') + to.close() + + return topN_tags + + +def parse_args(): + parser = argparse.ArgumentParser( + description='Predict the topN tags of the music-clip in file_name with the selected model') + + parser.add_argument('file_name', + type=str, + help='audio file to process') + + parser.add_argument('-mod', '--model', metavar='', + type=str, + default='MTT_musicnn', + help='select the music audio tagging model to employ (python -m musicnn.tagger music.mp3 --model MTT_musicnn)', + required=False) + + parser.add_argument('-n', '--topN', metavar='', + type=int, + default=3, + help='extract N most likely tags according to the selected model (python -m musicnn.tagger music.mp3 --topN 10)', + required=False) + + parser.add_argument('-len', '--length', metavar='', + type=float, + default=3.0, + help='length (in seconds) of the input spectrogram patches (python -m musicnn.tagger music.mp3 -len 3.1)', + required=False) + + parser.add_argument('-ov', '--overlap', metavar='', + type=float, + default=False, + help='ammount of overlap (in seconds) of the input spectrogram patches (python -m musicnn.tagger music.mp3 -ov 1.0)', + required=False) + + parser.add_argument('-p', '--print', + default=False, + action='store_true', + help='employ --print flag for printing the tags (python -m musicnn.tagger music.mp3 --print)', + required=False) + + parser.add_argument('-s', '--save', metavar='', + type=str, + default=False, + help='path where to store/save the tags (python -m musicnn.tagger music.mp3 --save out.tags)', + required=False) + + args = parser.parse_args() + + return args + + +if __name__ == '__main__': + # read parameters from command line + params = parse_args() + + # predict topN tags + topN_tags = top_tags(params.file_name, + model=params.model, + topN=params.topN, + input_length=params.length, + input_overlap=params.overlap, + print_tags=params.print, + save_tags=params.save) diff --git a/apollo/engine/models/__init__.py b/apollo/engine/models/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apollo/engine/postprocessors/__init__.py b/apollo/engine/postprocessors/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apollo/engine/preprocessors/__init__.py b/apollo/engine/preprocessors/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apollo/pipeline/executors/__init__.py b/apollo/pipeline/executors/__init__.py new file mode 100644 index 00000000..4f4f963e --- /dev/null +++ b/apollo/pipeline/executors/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# coding: utf8 + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +""" Packages that provides executors for the library. """ diff --git a/apollo/pipeline/executors/pipeline.py b/apollo/pipeline/executors/pipeline.py new file mode 100644 index 00000000..b19b8f77 --- /dev/null +++ b/apollo/pipeline/executors/pipeline.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +pipeline.py: +File containing Pipeline class to be used as the main orchestrator. +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +from apollo.common.misc.constants import ReturnCode +from apollo.pipeline.jobs.interface.job import Job + + +class Pipeline: + """ + Pipeline class to be used to be used as the main orchestrator. + """ + + def __init__(self) -> None: + self.__jobs: list = [] + + def execute(self) -> ReturnCode: + rc = ReturnCode.APOLLO_RC_SUCCESS + for job in self.__jobs: + rc = job.execute() + if rc != ReturnCode.APOLLO_RC_SUCCESS: + break + return rc + + def submit_job(self, job: Job) -> ReturnCode: + self.__jobs.append(job) + return ReturnCode.APOLLO_RC_SUCCESS + + def submit_probe(self) -> ReturnCode: + raise NotImplemented diff --git a/apollo/pipeline/jobs/__init__.py b/apollo/pipeline/jobs/__init__.py new file mode 100644 index 00000000..a048b0db --- /dev/null +++ b/apollo/pipeline/jobs/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# coding: utf8 + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +""" Packages that provides jobs for the library. """ diff --git a/apollo/pipeline/jobs/concrete/__init__.py b/apollo/pipeline/jobs/concrete/__init__.py new file mode 100644 index 00000000..d87ac488 --- /dev/null +++ b/apollo/pipeline/jobs/concrete/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# coding: utf8 + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +""" Packages that provides concrete implementation for jobs for the library. """ diff --git a/apollo/pipeline/jobs/concrete/genre_tagging_job.py b/apollo/pipeline/jobs/concrete/genre_tagging_job.py new file mode 100644 index 00000000..b52addea --- /dev/null +++ b/apollo/pipeline/jobs/concrete/genre_tagging_job.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +genre_tagging_job.py: +File containing GenreTaggingJob class to be used as an executor for the pipeline. +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +from apollo.common.misc.constants import ReturnCode +from apollo.pipeline.jobs.interface.job import Job + + +class GenreTaggingJob(Job): + """ + Job class to be used as the executors for the pipeline. + """ + + def __init__(self) -> None: + super().__init__() + + def initialize(self) -> ReturnCode: + raise NotImplemented + + def terminate(self) -> ReturnCode: + raise NotImplemented + + def feed(self) -> ReturnCode: + raise NotImplemented + + def execute(self): + raise NotImplemented diff --git a/apollo/pipeline/jobs/concrete/separation_job.py b/apollo/pipeline/jobs/concrete/separation_job.py new file mode 100644 index 00000000..9eefd6f3 --- /dev/null +++ b/apollo/pipeline/jobs/concrete/separation_job.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +separation_job.py: +File containing SeparationJob class to be used as an executor for the pipeline. +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +from apollo.common.misc.constants import ReturnCode +from apollo.pipeline.jobs.interface.job import Job + + +class SeparationJob(Job): + """ + Job class to be used as the executors for the pipeline. + """ + + def __init__(self) -> None: + super().__init__() + + def initialize(self) -> ReturnCode: + pass + + def terminate(self) -> ReturnCode: + pass + + def feed(self) -> ReturnCode: + pass + + def execute(self): + pass diff --git a/apollo/pipeline/jobs/interface/__init__.py b/apollo/pipeline/jobs/interface/__init__.py new file mode 100644 index 00000000..0696c898 --- /dev/null +++ b/apollo/pipeline/jobs/interface/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# coding: utf8 + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +""" Packages that provides interface for jobs for the library. """ diff --git a/apollo/pipeline/jobs/interface/job.py b/apollo/pipeline/jobs/interface/job.py new file mode 100644 index 00000000..b57664cc --- /dev/null +++ b/apollo/pipeline/jobs/interface/job.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# coding: utf8 + +""" +job.py: +File containing Job class to be used as the executors for the pipeline. +""" + +__author__ = "Zeyad Osama" +__license__ = "MIT License" + +from abc import ABC, abstractmethod + +from apollo.common.misc.constants import ReturnCode + + +class Job(ABC): + """ + Job class to be used as the executors for the pipeline. + """ + + def __init__(self) -> None: + super().__init__() + + @abstractmethod + def initialize(self) -> ReturnCode: + pass + + @abstractmethod + def terminate(self) -> ReturnCode: + pass + + @abstractmethod + def feed(self) -> ReturnCode: + pass + + @abstractmethod + def execute(self): + pass diff --git a/apollo/pipeline/pipeline/__init__.py b/apollo/pipeline/pipeline/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/apollo/pipeline/pipeline/job.py b/apollo/pipeline/pipeline/job.py new file mode 100644 index 00000000..2ccd49d6 --- /dev/null +++ b/apollo/pipeline/pipeline/job.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +"""job.py: File containing Job class to be used as the executors for the pipeline.""" + +__author__ = "Zeyad Osama" + + +class Job: + """ + Job class to be used as the executors for the pipeline. + """ + + def __init__(self) -> None: + super().__init__() + + def initialize(self): + pass + + def terminate(self): + pass + + def feed(self): + pass + + def execute(self): + pass diff --git a/conda-requirements.txt b/conda-requirements.txt new file mode 100644 index 00000000..d6c5e2d7 --- /dev/null +++ b/conda-requirements.txt @@ -0,0 +1,126 @@ +_tflow_select=2.3.0=mkl +absl-py=0.13.0=py37hecd8cb5_0 +astor=0.8.1=py37hecd8cb5_0 +audioread=2.1.9=py37hf985489_0 +blas=1.0=mkl +brotlipy=0.7.0=py37h9ed2024_1003 +bzip2=1.0.8=h1de35cc_0 +c-ares=1.17.1=h9ed2024_0 +ca-certificates=2021.5.25=hecd8cb5_1 +cached-property=1.5.2=py_0 +certifi=2021.5.30=py37hecd8cb5_0 +cffi=1.14.5=py37h2125817_0 +chardet=4.0.0=py37hecd8cb5_1003 +click=8.0.1=pyhd3eb1b0_0 +coverage=5.5=py37h9ed2024_2 +cryptography=3.4.7=py37h2fd3fbb_0 +cycler=0.10.0=py37_0 +cython=0.29.23=py37h23ab428_0 +decorator=5.0.9=pyhd3eb1b0_0 +ffmpeg=4.2.2=h97e5cf8_0 +ffmpeg-python=0.2.0=py_0 +flask=1.1.2=pyhd3eb1b0_0 +flask-cors=3.0.10=pyhd3eb1b0_0 +freetype=2.10.4=ha233b18_0 +future=0.18.2=py37_1 +gast=0.2.2=py37_0 +gettext=0.21.0=h7535e17_0 +gmp=6.2.1=h23ab428_2 +gnutls=3.6.15=hed9c0bf_0 +grpcio=1.36.1=py37h97de6d8_1 +gunicorn=20.1.0=py37hecd8cb5_0 +h5py=3.2.1=py37h90fc2a2_0 +hdf5=1.10.6=hdbbcd12_0 +icu=58.2=h0a44026_3 +idna=2.10=pyhd3eb1b0_0 +importlib-metadata=3.10.0=py37hecd8cb5_0 +intel-openmp=2021.2.0=hecd8cb5_564 +itsdangerous=2.0.1=pyhd3eb1b0_0 +jinja2=3.0.1=pyhd3eb1b0_0 +joblib=1.0.1=pyhd3eb1b0_0 +jpeg=9b=he5867d9_2 +keras-applications=1.0.8=py_1 +keras-preprocessing=1.1.2=pyhd3eb1b0_0 +kiwisolver=1.3.1=py37h23ab428_0 +lame=3.100=h1de35cc_0 +lcms2=2.12=hf1fd2bf_0 +libcxx=10.0.0=1 +libffi=3.3=hb1e8313_2 +libflac=1.3.3=h4a8c4bd_0 +libgfortran=3.0.1=h93005f0_2 +libiconv=1.16=h1de35cc_0 +libidn2=2.3.1=h9ed2024_0 +libogg=1.3.5=h9ed2024_1 +libopus=1.3.1=h1de35cc_0 +libpng=1.6.37=ha441bb4_0 +libprotobuf=3.14.0=h2842e9f_0 +librosa=0.7.2=py_1 +libsndfile=1.0.28=h4a8c4bd_1000 +libtasn1=4.16.0=h9ed2024_0 +libtiff=4.2.0=h87d7836_0 +libunistring=0.9.10=h9ed2024_0 +libvorbis=1.3.7=haf1e3a3_0 +libvpx=1.7.0=h378b8a2_0 +libwebp-base=1.2.0=h9ed2024_0 +libxml2=2.9.12=hcdb78fc_0 +llvm-openmp=10.0.0=h28b9765_0 +llvmlite=0.31.0=py37h1341992_0 +lz4-c=1.9.3=h23ab428_0 +markdown=3.3.4=py37hecd8cb5_0 +markupsafe=2.0.1=py37h9ed2024_0 +matplotlib-base=3.3.4=py37h8b3ea08_0 +mkl=2021.2.0=hecd8cb5_269 +mkl-service=2.3.0=py37h9ed2024_1 +mkl_fft=1.3.0=py37h4a7008c_2 +mkl_random=1.2.1=py37hb2f4e1b_2 +ncurses=6.2=h0a44026_1 +nettle=3.7.3=h230ac6f_1 +norbert=0.2.1=py_0 +numba=0.48.0=py37h6c726b0_0 +numpy=1.20.2=py37h4b4dc7a_0 +numpy-base=1.20.2=py37he0bd621_0 +olefile=0.46=py37_0 +openh264=2.1.0=hd9629dc_0 +openssl=1.1.1k=h9ed2024_0 +pandas=0.25.1=py37h0a44026_0 +pillow=8.2.0=py37h5270095_0 +pip=21.1.2=py37hecd8cb5_0 +protobuf=3.14.0=py37h23ab428_1 +pycparser=2.20=py_2 +pydub=0.25.1=pyhd8ed1ab_0 +pyopenssl=20.0.1=pyhd3eb1b0_1 +pyparsing=2.4.7=pyhd3eb1b0_0 +pysocks=1.7.1=py37hecd8cb5_0 +pysoundfile=0.10.3.post1=pyhd3deb0d_0 +python=3.7.10=h88f2d9e_0 +python-dateutil=2.8.1=pyhd3eb1b0_0 +python_abi=3.7=2_cp37m +pytz=2021.1=pyhd3eb1b0_0 +readline=8.1=h9ed2024_0 +requests=2.25.1=pyhd3eb1b0_0 +resampy=0.2.2=py_0 +scikit-learn=0.24.2=py37hb2f4e1b_0 +scipy=1.6.2=py37hd5f7400_1 +setuptools=52.0.0=py37hecd8cb5_0 +six=1.16.0=pyhd3eb1b0_0 +spleeter=1.5.0=py37hc8dfbb8_0 +sqlite=3.36.0=hce871da_0 +tbb=2021.2.0=hf7b0b51_0 +tensorboard=1.14.0=py37h80053f4_0 +tensorflow=1.14.0=mkl_py37h085be34_0 +tensorflow-base=1.14.0=mkl_py37h5a24fda_0 +tensorflow-estimator=1.14.0=py_0 +termcolor=1.1.0=py37hecd8cb5_1 +threadpoolctl=2.1.0=pyh5ca1d4c_0 +tk=8.6.10=hb0a8c7a_0 +tornado=6.1=py37h9ed2024_0 +typing_extensions=3.7.4.3=pyha847dfd_0 +urllib3=1.26.4=pyhd3eb1b0_0 +werkzeug=1.0.1=pyhd3eb1b0_0 +wheel=0.36.2=pyhd3eb1b0_0 +wrapt=1.12.1=py37h1de35cc_1 +x264=1!157.20191217=h1de35cc_0 +xz=5.2.5=h1de35cc_0 +zipp=3.4.1=pyhd3eb1b0_0 +zlib=1.2.11=h1de35cc_3 +zstd=1.4.9=h322a384_0 diff --git a/configs/config.json b/configs/config.json deleted file mode 100644 index e69de29b..00000000 diff --git a/docker/base.dockerfile b/docker/base.dockerfile deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 56f6fad3..00000000 --- a/docs/README.md +++ /dev/null @@ -1 +0,0 @@ -# Documents \ No newline at end of file diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..229c3d3b --- /dev/null +++ b/environment.yml @@ -0,0 +1,134 @@ +name: apollo + +channels: + - defaults + - anaconda + - conda-forge +dependencies: + - python=3.7.* + - _tflow_select=2.3.0=mkl + - absl-py=0.13.0=py37hecd8cb5_0 + - astor=0.8.1=py37hecd8cb5_0 + - audioread=2.1.9=py37hf985489_0 + - blas=1.0=mkl + - brotlipy=0.7.0=py37h9ed2024_1003 + - bzip2=1.0.8=h1de35cc_0 + - c-ares=1.17.1=h9ed2024_0 + - ca-certificates=2021.5.25=hecd8cb5_1 + - cached-property=1.5.2=py_0 + - certifi=2021.5.30=py37hecd8cb5_0 + - cffi=1.14.5=py37h2125817_0 + - chardet=4.0.0=py37hecd8cb5_1003 + - click=8.0.1=pyhd3eb1b0_0 + - coverage=5.5=py37h9ed2024_2 + - cryptography=3.4.7=py37h2fd3fbb_0 + - cycler=0.10.0=py37_0 + - cython=0.29.23=py37h23ab428_0 + - decorator=5.0.9=pyhd3eb1b0_0 + - ffmpeg=4.2.2=h97e5cf8_0 + - ffmpeg-python=0.2.0=py_0 + - flask=1.1.2=pyhd3eb1b0_0 + - flask-cors=3.0.10=pyhd3eb1b0_0 + - freetype=2.10.4=ha233b18_0 + - future=0.18.2=py37_1 + - gast=0.2.2=py37_0 + - gettext=0.21.0=h7535e17_0 + - gmp=6.2.1=h23ab428_2 + - gnutls=3.6.15=hed9c0bf_0 + - grpcio=1.36.1=py37h97de6d8_1 + - gunicorn=20.1.0=py37hecd8cb5_0 + - h5py=3.2.1=py37h90fc2a2_0 + - hdf5=1.10.6=hdbbcd12_0 + - icu=58.2=h0a44026_3 + - idna=2.10=pyhd3eb1b0_0 + - importlib-metadata=3.10.0=py37hecd8cb5_0 + - intel-openmp=2021.2.0=hecd8cb5_564 + - itsdangerous=2.0.1=pyhd3eb1b0_0 + - jinja2=3.0.1=pyhd3eb1b0_0 + - joblib=1.0.1=pyhd3eb1b0_0 + - jpeg=9b=he5867d9_2 + - keras-applications=1.0.8=py_1 + - keras-preprocessing=1.1.2=pyhd3eb1b0_0 + - kiwisolver=1.3.1=py37h23ab428_0 + - lame=3.100=h1de35cc_0 + - lcms2=2.12=hf1fd2bf_0 + - libcxx=10.0.0=1 + - libffi=3.3=hb1e8313_2 + - libflac=1.3.3=h4a8c4bd_0 + - libgfortran=3.0.1=h93005f0_2 + - libiconv=1.16=h1de35cc_0 + - libidn2=2.3.1=h9ed2024_0 + - libogg=1.3.5=h9ed2024_1 + - libopus=1.3.1=h1de35cc_0 + - libpng=1.6.37=ha441bb4_0 + - libprotobuf=3.14.0=h2842e9f_0 + - librosa=0.7.2=py_1 + - libsndfile=1.0.28=h4a8c4bd_1000 + - libtasn1=4.16.0=h9ed2024_0 + - libtiff=4.2.0=h87d7836_0 + - libunistring=0.9.10=h9ed2024_0 + - libvorbis=1.3.7=haf1e3a3_0 + - libvpx=1.7.0=h378b8a2_0 + - libwebp-base=1.2.0=h9ed2024_0 + - libxml2=2.9.12=hcdb78fc_0 + - llvm-openmp=10.0.0=h28b9765_0 + - llvmlite=0.31.0=py37h1341992_0 + - lz4-c=1.9.3=h23ab428_0 + - markdown=3.3.4=py37hecd8cb5_0 + - markupsafe=2.0.1=py37h9ed2024_0 + - matplotlib-base=3.3.4=py37h8b3ea08_0 + - mkl=2021.2.0=hecd8cb5_269 + - mkl-service=2.3.0=py37h9ed2024_1 + - mkl_fft=1.3.0=py37h4a7008c_2 + - mkl_random=1.2.1=py37hb2f4e1b_2 + - ncurses=6.2=h0a44026_1 + - nettle=3.7.3=h230ac6f_1 + - norbert=0.2.1=py_0 + - numba=0.48.0=py37h6c726b0_0 + - numpy=1.20.2=py37h4b4dc7a_0 + - numpy-base=1.20.2=py37he0bd621_0 + - olefile=0.46=py37_0 + - openh264=2.1.0=hd9629dc_0 + - openssl=1.1.1k=h9ed2024_0 + - pandas=0.25.1=py37h0a44026_0 + - pillow=8.2.0=py37h5270095_0 + - pip=21.1.2=py37hecd8cb5_0 + - protobuf=3.14.0=py37h23ab428_1 + - pycparser=2.20=py_2 + - pydub=0.25.1=pyhd8ed1ab_0 + - pyopenssl=20.0.1=pyhd3eb1b0_1 + - pyparsing=2.4.7=pyhd3eb1b0_0 + - pysocks=1.7.1=py37hecd8cb5_0 + - pysoundfile=0.10.3.post1=pyhd3deb0d_0 + - python=3.7.10=h88f2d9e_0 + - python-dateutil=2.8.1=pyhd3eb1b0_0 + - python_abi=3.7=2_cp37m + - pytz=2021.1=pyhd3eb1b0_0 + - readline=8.1=h9ed2024_0 + - requests=2.25.1=pyhd3eb1b0_0 + - resampy=0.2.2=py_0 + - scikit-learn=0.24.2=py37hb2f4e1b_0 + - scipy=1.6.2=py37hd5f7400_1 + - setuptools=52.0.0=py37hecd8cb5_0 + - six=1.16.0=pyhd3eb1b0_0 + - spleeter=1.5.0=py37hc8dfbb8_0 + - sqlite=3.36.0=hce871da_0 + - tbb=2021.2.0=hf7b0b51_0 + - tensorboard=1.14.0=py37h80053f4_0 + - tensorflow=1.14.0=mkl_py37h085be34_0 + - tensorflow-base=1.14.0=mkl_py37h5a24fda_0 + - tensorflow-estimator=1.14.0=py_0 + - termcolor=1.1.0=py37hecd8cb5_1 + - threadpoolctl=2.1.0=pyh5ca1d4c_0 + - tk=8.6.10=hb0a8c7a_0 + - tornado=6.1=py37h9ed2024_0 + - typing_extensions=3.7.4.3=pyha847dfd_0 + - urllib3=1.26.4=pyhd3eb1b0_0 + - werkzeug=1.0.1=pyhd3eb1b0_0 + - wheel=0.36.2=pyhd3eb1b0_0 + - wrapt=1.12.1=py37h1de35cc_1 + - x264=1!157.20191217=h1de35cc_0 + - xz=5.2.5=h1de35cc_0 + - zipp=3.4.1=pyhd3eb1b0_0 + - zlib=1.2.11=h1de35cc_3 + - zstd=1.4.9=h322a384_0 diff --git a/notebooks/genre_classification.ipynb b/notebooks/genre_classification.ipynb deleted file mode 100644 index a7c63aac..00000000 --- a/notebooks/genre_classification.ipynb +++ /dev/null @@ -1,43 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "source": [ - "# Genre Classification" - ], - "metadata": { - "collapsed": false - } - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} \ No newline at end of file diff --git a/notebooks/lyrics_transcription.ipynb b/notebooks/lyrics_transcription.ipynb deleted file mode 100644 index 0d960e3a..00000000 --- a/notebooks/lyrics_transcription.ipynb +++ /dev/null @@ -1,43 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "source": [ - "# Lyrics Transcription" - ], - "metadata": { - "collapsed": false - } - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} \ No newline at end of file diff --git a/notebooks/stem_separation.ipynb b/notebooks/stem_separation.ipynb deleted file mode 100644 index 26b6f51c..00000000 --- a/notebooks/stem_separation.ipynb +++ /dev/null @@ -1,43 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "source": [ - "# Stem Separation" - ], - "metadata": { - "collapsed": false - } - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..5102de75 --- /dev/null +++ b/package.json @@ -0,0 +1,49 @@ +{ + "name": "apollo", + "version": "1.0.0", + "author": "Rewan Maklad, Omar Marzouk, Marwan Elsafty, Zeyad Osama", + "description": "Music processing engine.", + "license": "MIT", + "private": false, + "engines": { + "node": "15.0.1", + "npm": "7.0.3" + }, + "dependencies": { + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^11.2.7", + "@testing-library/user-event": "^12.8.3", + "axios": "^0.21.1", + "bootstrap": "^5.0.1", + "history": "^4.10.1", + "react": "^17.0.2", + "react-bootstrap": "^1.6.1", + "react-bootstrap-icons": "^1.5.0", + "react-dom": "^17.0.2", + "react-icons": "^4.2.0", + "react-router": "^5.2.0", + "react-router-dom": "^5.2.0", + "react-scripts": "4.0.3", + "reactstrap": "^8.9.0", + "web-vitals": "^1.1.2" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "main": "src/index.jsx", + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 00000000..4aeed47c Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 00000000..66264879 --- /dev/null +++ b/public/index.html @@ -0,0 +1,45 @@ + + + + + + + Apollo + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 00000000..04e997c8 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "Apollo", + "name": "Apollo", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/samples/Eminem - Rap God.mp3 b/samples/Eminem - Rap God.mp3 new file mode 100644 index 00000000..2699a85a Binary files /dev/null and b/samples/Eminem - Rap God.mp3 differ diff --git a/samples/Nirvana - Smells Like Teen Spirit.mp3 b/samples/Nirvana - Smells Like Teen Spirit.mp3 new file mode 100644 index 00000000..f4250c86 Binary files /dev/null and b/samples/Nirvana - Smells Like Teen Spirit.mp3 differ diff --git a/samples/The Weeknd - Blinding Lights.mp3 b/samples/The Weeknd - Blinding Lights.mp3 new file mode 100644 index 00000000..87021178 Binary files /dev/null and b/samples/The Weeknd - Blinding Lights.mp3 differ diff --git a/samples/Umm Kulthum - Enta Omry.mp3 b/samples/Umm Kulthum - Enta Omry.mp3 new file mode 100644 index 00000000..01398c64 Binary files /dev/null and b/samples/Umm Kulthum - Enta Omry.mp3 differ diff --git a/server/app.py b/server/app.py new file mode 100644 index 00000000..ac0b19b4 --- /dev/null +++ b/server/app.py @@ -0,0 +1,192 @@ +# !/usr/bin/env python +# coding: utf8 + +""" +app.py: +""" + +__author__ = "Omar Marzouk" +__license__ = "MIT License" + +import os +import shutil +import subprocess +import sys + +from flask import Flask, request, send_file +from flask_cors import CORS +from pydub import AudioSegment +from werkzeug.utils import secure_filename + +dir_curr = os.path.dirname(os.path.realpath(__file__)) +dir_root = os.path.abspath(os.path.join(dir_curr, '..')) +if dir_root not in sys.path: + sys.path.append(dir_root) + +from apollo.engine.genre_classification.extractor import extractor + +app = Flask(__name__) +cors = CORS(app, expose_headers='Authorization') +app.config['CORS_HEADERS'] = 'Content-Type' + +RESULT_FILE = "audio.wav" +RESULT_MP3 = "audio.mp3" + +DIR_RESULTS = 'results/' +DIR_STEM = DIR_RESULTS + 'stem/' +DIR_SEP = DIR_STEM + 'audio/' +DIR_PLOT = DIR_RESULTS + 'plot/' + +EXT_WAV = '.wav' +EXT_MP3 = '.mp3' +EXT_IMG = '.png' +MIMETYPE_AUDIO = 'audio/wav' + + +def setup_dirs(): + try: + os.makedirs(DIR_RESULTS, exist_ok=True) + print('Directory {} created successfully.'.format(DIR_RESULTS)) + except OSError: + print('Directory {} could not be created.'.format(DIR_RESULTS)) + + try: + os.makedirs(DIR_STEM, exist_ok=True) + print('Directory {} created successfully.'.format(DIR_STEM)) + except OSError: + print('Directory {} could not be created.'.format(DIR_STEM)) + + try: + os.makedirs(DIR_PLOT, exist_ok=True) + print('Directory {} created successfully.'.format(DIR_PLOT)) + except OSError: + print('Directory {} could not be created.'.format(DIR_PLOT)) + + +@app.route('/', methods=['GET', 'POST']) +def uploaded_file(): + setup_dirs() + dst = DIR_RESULTS + RESULT_FILE + if request.method == 'POST': + f = request.files["myFile"] + path = "audio_dataset/" + f.filename + print(f.filename) + if ".mp3" in f.filename: + # Convert .mp3 to .wav + if os.path.exists(dst): + os.remove(dst) + secure = DIR_RESULTS + secure_filename(f.filename) + f.save(secure) + os.rename(secure, DIR_RESULTS + RESULT_MP3) + sound = AudioSegment.from_mp3(DIR_RESULTS + RESULT_MP3) + sound.export(dst, format="wav") + elif "recorded_audio" in f.filename: + subprocess.call(['ffmpeg', '-i', path, dst]) + else: + secure = DIR_RESULTS + secure_filename(f.filename) + f.save(secure) + AudioSegment.from_wav(secure).export(DIR_RESULTS + RESULT_MP3, format="mp3") + if os.path.exists(DIR_STEM + "audio/"): + shutil.rmtree(DIR_STEM + "audio/") + return "done!" + + +def separate(num: int): + os.system( + "spleeter separate -i {}audio.wav -p spleeter:{}stems -B tensorflow -o {}".format(DIR_RESULTS, num, DIR_STEM)) + return "done!" + + +def send_audio(name: str, f_dir: str = DIR_SEP): + name = name + EXT_WAV + while True: + if os.path.exists(f_dir + name): + break + return send_file(f_dir + name, + mimetype=MIMETYPE_AUDIO, + as_attachment=True, + attachment_filename=name) + + +@app.route('/GetTwoStems') +def separate_two(): + if os.path.exists(DIR_STEM + "audio/accompaniment.wav"): + return "done!" + return separate(2) + + +@app.route('/GetFourStems') +def separate_four(): + if os.path.exists(DIR_STEM + "audio/") and len(os.listdir(DIR_STEM + "audio/")) >= 4: + return "done!" + return separate(4) + + +@app.route('/GetFiveStems') +def separate_five(): + if os.path.exists(DIR_STEM + "audio/piano.wav"): + return "done!" + return separate(5) + + +@app.route("/Original") +def send_original(): + return send_audio('audio', f_dir=DIR_RESULTS) + + +@app.route("/Vocals") +def send_vocal(): + return send_audio('vocals') + + +@app.route("/Instrumental") +def send_instruments(): + return send_audio('accompaniment') + + +@app.route("/Bass") +def send_bass(): + return send_audio('bass') + + +@app.route("/Drums") +def send_drums(): + return send_audio('drums') + + +@app.route("/Piano") +def send_piano(): + return send_audio('piano') + + +@app.route("/Other") +def send_other(): + return send_audio('other') + + +@app.route('/MusicTags') +def music_tag(): + setup_dirs() + if request.method == 'GET': + name = 'PieChart' + EXT_IMG + if os.path.exists(DIR_PLOT + name): + os.remove(DIR_PLOT + name) + extractor(DIR_RESULTS + RESULT_MP3, DIR_PLOT) + return send_file(DIR_PLOT + name, mimetype='image/png') + + +@app.after_request +def add_header(r): + """ + Add headers to both force latest IE rendering engine or Chrome Frame, + and also to cache the rendered page for 10 minutes. + """ + r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" + r.headers["Pragma"] = "no-cache" + r.headers["Expires"] = "0" + r.headers['Cache-Control'] = 'public, max-age=0' + return r + + +if __name__ == '__main__': + app.run(debug=True, threaded=True) diff --git a/setup.py b/setup.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/App.js b/src/App.js new file mode 100644 index 00000000..9b445899 --- /dev/null +++ b/src/App.js @@ -0,0 +1,27 @@ +import React from 'react'; +import Routes from './Routes' +import {NavigationBar} from './js/elements/NavigationBar' +import {BrowserRouter as Router} from 'react-router-dom'; + +import './css/styles.css'; + + +export default function App() { + return ( +
+ +
+ + +
+
+ + +
+

+ © 2021 Apollo. All rights reserved. +

+
+
+ ) +} diff --git a/src/App.test.js b/src/App.test.js new file mode 100644 index 00000000..d10fed7c --- /dev/null +++ b/src/App.test.js @@ -0,0 +1,13 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import {MemoryRouter} from 'react-router-dom'; +import App from './App'; + +it('renders without crashing', async () => { + const div = document.createElement('div'); + ReactDOM.render( + + + , div); + await new Promise(resolve => setTimeout(resolve, 1000)); +}); diff --git a/src/Routes.js b/src/Routes.js new file mode 100644 index 00000000..0bbcac56 --- /dev/null +++ b/src/Routes.js @@ -0,0 +1,35 @@ +import React from 'react'; +import {Route} from 'react-router'; + +import {Home} from './js/base/Home'; +import {howItWorks} from './js/base/HowItWorks'; +import {FAQ} from './js/base/FAQ'; +import {Tools} from './js/base/Tools'; +import {StemSeparation} from './js/stem-separation/StemSeparation'; +import {MusicTagging} from './js/music-tagging/MusicTagging'; +import {TwoStems} from './js/stem-separation/TwoStems'; +import {FiveStems} from './js/stem-separation/FiveStems'; +import {FourStems} from './js/stem-separation/FourStems'; +import {Router, Switch} from 'react-router-dom'; + +import history from './js/base/History' + +function Routes() { + return ( + + + + + + + + + + + + + + ) +} + +export default Routes; diff --git a/src/assets/background.jpg b/src/assets/background.jpg new file mode 100644 index 00000000..8ce13450 Binary files /dev/null and b/src/assets/background.jpg differ diff --git a/src/assets/download.jpeg b/src/assets/download.jpeg new file mode 100644 index 00000000..3de38925 Binary files /dev/null and b/src/assets/download.jpeg differ diff --git a/src/css/animation.css b/src/css/animation.css new file mode 100644 index 00000000..79b14b30 --- /dev/null +++ b/src/css/animation.css @@ -0,0 +1,36 @@ +.animation, .animation span { + animation-duration: 1.25s; + animation-fill-mode: both; +} + +.animation span { + display: inline-block +} + +.fadeInBottom-wide { + animation-name: fadeInBottom-wide +} + +@keyframes fadeInBottom-wide { + from { + opacity: 0; + transform: translateY(100%); + } + to { + opacity: 1 + } +} + +.fadeInBottom-narrow { + animation-name: fadeInBottom-narrow +} + +@keyframes fadeInBottom-narrow { + from { + opacity: 0; + transform: translateY(20%); + } + to { + opacity: 1 + } +} diff --git a/src/css/audio.css b/src/css/audio.css new file mode 100644 index 00000000..fe2c643e --- /dev/null +++ b/src/css/audio.css @@ -0,0 +1,134 @@ +.audio-player { + border-radius: 0 0 15px 15px; + height: 50px; + width: 350px; + background: rgba(0, 0, 0, 0.5); + box-shadow: 0 0 20px 0 #000a; + font-family: Montserrat, serif; + color: white; + font-size: 0.75em; + overflow: hidden; + display: grid; + grid-template-rows: 6px auto; +} + +.audio-player .timeline { + background: white; + width: 100%; + position: relative; + cursor: pointer; + box-shadow: 0 2px 10px 0 #0008; +} + +.audio-player .timeline .progress { + border-radius: 0; + background: rgb(255, 255, 255) linear-gradient(to left, #49a09d, #5f2c82); + width: 0; + height: 100%; + transition: 0.25s; +} + +.audio-player .controls { + display: flex; + justify-content: space-between; + align-items: stretch; + padding: 0 20px; +} + +.audio-player .controls > * { + display: flex; + justify-content: center; + align-items: center; +} + +.audio-player .controls .toggle-play.play { + cursor: pointer; + position: relative; + left: 0; + height: 0; + width: 0; + border: 7px solid #0000; + border-left: 13px solid white; +} + +.audio-player .controls .toggle-play.play:hover { + transform: scale(1.1); +} + +.audio-player .controls .toggle-play.pause { + height: 15px; + width: 20px; + cursor: pointer; + position: relative; +} + +.audio-player .controls .toggle-play.pause:before { + position: absolute; + top: 0; + left: 0; + background: white; + content: ""; + height: 15px; + width: 3px; +} + +.audio-player .controls .toggle-play.pause:after { + position: absolute; + top: 0; + right: 8px; + background: white; + content: ""; + height: 15px; + width: 3px; +} + +.audio-player .controls .toggle-play.pause:hover { + transform: scale(1.1); +} + +.audio-player .controls .time { + display: flex; +} + +.audio-player .controls .time > * { + padding: 2px; +} + +.audio-player .controls .volume-container { + cursor: pointer; + position: relative; + z-index: 2; +} + +.audio-player .controls .volume-container .volume-button { + height: 26px; + display: flex; + align-items: center; +} + +.audio-player .controls .volume-container .volume-button .volume { + transform: scale(0.7); +} + +.audio-player .controls .volume-container .volume-slider { + position: absolute; + left: -3px; + top: 15px; + z-index: -1; + width: 0; + height: 15px; + background: white; + box-shadow: 0 0 20px #000a; + transition: 0.25s; +} + +.audio-player .controls .volume-container .volume-slider .volume-percentage { + background: #49a09d; + height: 100%; + width: 75%; +} + +.audio-player .controls .volume-container:hover .volume-slider { + left: -123px; + width: 120px; +} diff --git a/src/css/download.css b/src/css/download.css new file mode 100644 index 00000000..fac09e12 --- /dev/null +++ b/src/css/download.css @@ -0,0 +1,14 @@ +.download-btn { + color: white; + font-size: large; +} + +.download-btn a { + color: white; + text-decoration: none; +} + +.download-btn a:hover { + color: #49a09d; + text-decoration: none; +} diff --git a/src/css/spinners.css b/src/css/spinners.css new file mode 100644 index 00000000..58371e3c --- /dev/null +++ b/src/css/spinners.css @@ -0,0 +1,40 @@ +.bouncer { + margin: auto; + display: flex; + justify-content: space-around; + align-items: flex-end; + width: 100px; + height: 100px; +} + +.bouncer div { + width: 20px; + height: 20px; + background-color: white; + border-radius: 50%; + animation: bouncer 0.5s cubic-bezier(0.19, 0.57, 0.3, 0.98) infinite alternate; +} + +.bouncer div:nth-child(2) { + animation-delay: 0.1s; + opacity: 0.8; +} + +.bouncer div:nth-child(3) { + animation-delay: 0.2s; + opacity: 0.6; +} + +.bouncer div:nth-child(4) { + animation-delay: 0.3s; + opacity: 0.4; +} + +@keyframes bouncer { + from { + transform: translateY(0); + } + to { + transform: translateY(-100px); + } +} diff --git a/src/css/styles.css b/src/css/styles.css new file mode 100644 index 00000000..dc706950 --- /dev/null +++ b/src/css/styles.css @@ -0,0 +1,223 @@ +* { + font-family: 'Montserrat', sans-serif; +} + +body { + background: rgba(255, 255, 255, 0) linear-gradient(to bottom right, #49a09d, #5f2c82) no-repeat fixed; + background-size: 100% 100vh; + font-weight: lighter; + color: white; +} + +h1 { + text-align: center; + font-weight: lighter; + color: white; + text-overflow: ellipsis; + overflow: hidden; +} + +audio { + border-radius: 10px; +} + +ul { + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + background-color: rgba(0, 0, 0, 0.20); +} + +li a { + display: block; + color: white; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} + +li a:hover { + background-color: rgba(0, 0, 0, 0.20); + color: white; + text-decoration: none; +} + +.font-lighter { + font-weight: lighter; +} + +.font-normal { + font-weight: normal; +} + +.font-bold { + font-weight: bold; +} + +.footer { + position: fixed; + left: 0; + bottom: 0; + height: 30px; + width: 100%; + background-color: rgba(0, 0, 0, 0.20); + color: white; + text-align: center; + font-size: small; + padding: 0.25rem; +} + +.navbar-brand { + /* background-color: rgb(94, 40, 40); */ + /* margin-right: 900px; */ + position: absolute; + left: 0; +} + +.title { + margin: 5rem auto 1rem auto; +} + +.shp-block { + color: white; + margin: 0 auto 5rem auto; +} + + +.subheader { + font-weight: bold; + margin: 2rem auto 1rem auto; +} + +.paragraph { + font-weight: lighter; +} + +.row { + display: flex; +} + +.column { + flex: 50%; +} + +.container-33 { + margin: auto; + width: 33%; + text-align: center; +} + +.container-77 { + margin: auto; + width: 77%; + text-align: center; +} + +.container-100 { + margin: auto; + width: 100%; + text-align: center; +} + +.float-right { + float: right; +} + +.float-left { + float: left; +} + +.margin-med { + margin: 10rem; +} + +.center { + text-align: center; + margin: auto; + width: 100%; +} + +.center-vertical { + text-align: center; + margin: auto 0; + height: 100%; +} + +.center-horizontal { + text-align: center; + margin: 0 auto; + height: 100%; +} + +.transparent { + color: transparent; +} + +.blurry { + background-color: rgba(0, 0, 0, 0.20); +} + +.width-100 { + width: 100% +} + +.audio-container { + display: flex; + margin: auto; + justify-content: center; + align-items: center; +} + +#exampleFormControlFile1 { + text-align: center; + padding: 25px; + width: 25rem; + height: 10rem; + margin: 100px 25px 25px 25px; + border: 1px solid; + color: white; + background-color: rgba(255, 255, 255, 0); +} + +.btn-secondary { + background-color: white; + border-radius: 20px; + color: rgb(43, 0, 25); + +} + +.btn-outline-secondary { + color: rgb(201, 39, 88); +} + +.jumbotron { + border-radius: 10px; + background: rgba(36, 33, 35, 0.418); + opacity: 0.8; + border-color: black; + padding: 20px; +} + +#clickable { + text-align: center; + padding: 25px; + width: 25rem; + height: 10rem; + margin: 100px 25px 25px 25px; + border: 1px solid; + color: white; + background-color: rgba(255, 255, 255, 0); +} + +#clickable:hover { + font-weight: bolder; + color: #552572; + border: 2px solid; + background-color: rgba(255, 255, 255, 0.226); +} + +.flex-center { + display: flex; + justify-content: center; +} diff --git a/src/index.jsx b/src/index.jsx new file mode 100644 index 00000000..b9da621f --- /dev/null +++ b/src/index.jsx @@ -0,0 +1,8 @@ +import 'bootstrap/dist/css/bootstrap.css'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; + +ReactDOM.render(, document.getElementById("root")); +//registerServiceWorker(); + diff --git a/src/js/base/FAQ.js b/src/js/base/FAQ.js new file mode 100644 index 00000000..6ab7dbc0 --- /dev/null +++ b/src/js/base/FAQ.js @@ -0,0 +1,70 @@ +import React, {Component} from 'react'; +import {Container} from "react-bootstrap"; + +export class FAQ extends Component { + render() { + return ( + +
+ +

+ FAQ +

+ +
+
+ Why "Apollo"? +
+

+ Apollo is one of the Olympian deities in classical Greek and Roman religion and Greek and + Roman mythology. The national divinity of the Greeks, Apollo has been recognized as a god of + archery, music and dance, poetry, and more. +

+ The day he was born, Hermes invented the lyre and stole Apollo’s cattle. So as to appease + his older brother after he found out what happened, Hermes offered Apollo his new invention. + Ever since then, the lyre became one of Apollo’s most famous attributes, and its most + celebrated master. +

+ For this reason and the projection that is caused upon our project we decided to name our + project “Apollo”. +

+
+ +
+
+ What is stem separation? +
+

+ Stems are simply units of any given audio signal as per the musical jargon; mixing these + units, or as we now know, stems, produces complex and harmonized sounds. +

+ Us human beings are superb in isolating these audio signals and process only the sounds we + need and suppress those we don’t need to hear. Humans' minds are really magnificent and + capable of doing astonishing stuff, yet, with the advancement of technology, it is possible + to record or create sounds that we can hear later. Now, various sectors deal with + manipulation and study of the sound signals that require stems, thus in that sense, we need + algorithms that can separate audio signals effectively. +

+ Since we can pick up little inconsistencies in the sound, the stem separation must be as + clear and crisp as possible. Hence, we would harness the capabilities of deep learning, + masking and regeneration to recreate individual stems. +

+
+ +
+
+ What is music tagging? +
+

+ Music tags is a set of descriptive keywords that carry high-level information about a music + clip; those keywords could reveal information about emotion, genre and instrumentation. +

+ Hence, tags could be used for music recommendation and discovery. +

+
+ +
+
+ ); + } +} diff --git a/src/js/base/History.js b/src/js/base/History.js new file mode 100644 index 00000000..e93806ed --- /dev/null +++ b/src/js/base/History.js @@ -0,0 +1,4 @@ +import {createBrowserHistory as history} from 'history'; + +export default history(); + diff --git a/src/js/base/Home.js b/src/js/base/Home.js new file mode 100644 index 00000000..2dcac4df --- /dev/null +++ b/src/js/base/Home.js @@ -0,0 +1,65 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; +import history from './History'; +import axios from 'axios'; + +import '../../css/styles.css'; +import '../../css/animation.css' + +export class Home extends Component { + state = { + selectedFile: null, + source: "" + } + + onFileChange = event => { + this.setState({ + selectedFile: event.target.files[0], + source: event.target.files[0].name + }); + }; + + onFileUpload = () => { + if (this.state.selectedFile != null) { + const formData = new FormData(); + formData.append("myFile", this.state.selectedFile, this.state.selectedFile.name); + console.log(this.state.selectedFile.name); + const url = process.env.APP_URL || 'http://localhost:5000/'; + axios.post(url, formData); + history.push("/Tools"); + } + } + + render() { + return ( + +
+ +

+ Attach Your Audio File Below +

+ +

+ +
+ + + +

+ + +
+ +
+
+ ); + } +} diff --git a/src/js/base/HowItWorks.js b/src/js/base/HowItWorks.js new file mode 100644 index 00000000..e74c7411 --- /dev/null +++ b/src/js/base/HowItWorks.js @@ -0,0 +1,65 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; + +export class howItWorks extends Component { + render() { + return ( + +
+ +

+ How It Works? +

+ +
+
+ 1. Attach. +
+

+ First thing first, in the home page, you shall find a file attachment box, in which you + could attach an audio file that you want to process it. +

+
+ +
+
+ 2. Choose. +
+

+ After attaching your audio file, you'll be provided by two options, one in which is the stem + separation option, whereas the other is the music tagging option; now choose what you'd like + to do with your audio file. +

+
+ +
+
+
+ 3.1. Stem Separation? +
+

+ So now that you chose the stem separation option, another option will be provided to + you. + Variety of stem separation options are offered; two, four and five stems separations are + available to be done to you audio file. Results shall then appear after choosing your + desired option +

+
+ +
+
+ 3.2. Music Tagging? +
+

+ Or you decided to choose the music tagging option. Results shall then appear after + choosing + your desired option +

+
+
+ +
+
+ ); + } +} diff --git a/src/js/base/Tools.js b/src/js/base/Tools.js new file mode 100644 index 00000000..c477d28e --- /dev/null +++ b/src/js/base/Tools.js @@ -0,0 +1,32 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; +import '../../css/styles.css'; + +export class Tools extends Component { + static displayName = Tools.name; + + render() { + return ( + +
+ +

+ Tools Page +

+ + + +
+
+ ); + } +} diff --git a/src/js/elements/AudioPlayer.js b/src/js/elements/AudioPlayer.js new file mode 100644 index 00000000..fd28c2ce --- /dev/null +++ b/src/js/elements/AudioPlayer.js @@ -0,0 +1,150 @@ +import React, {Component} from 'react'; + +import '../../css/styles.css'; +import '../../css/audio.css'; +import '../../css/animation.css' + +export class AudioPlayer extends Component { + + constructor(props) { + super(props); + this.audioPlayerRef = React.createRef(); + this.name = props.name; + this.url = process.env.APP_URL || 'http://localhost:5000/'; + } + + componentDidMount() { + const audioPlayer = this.audioPlayerRef; + const audio = new Audio(this.url + this.name); + + /** + * @function Audio event listener. + */ + audio.addEventListener( + "loadeddata", + () => { + if (audioPlayer.current) { + audioPlayer.current.querySelector(".time .length").textContent = getTimeCodeFromNum(audio.duration); + audio.volume = .75; + } + }, + false + ); + + /** + * @function Click on timeline to skip around. + * @type {Element} + */ + const timeline = audioPlayer.current.querySelector(".timeline"); + timeline.addEventListener("click", e => { + const rect = e.currentTarget.getBoundingClientRect(), offsetX = e.clientX - rect.left; + const timelineWidth = window.getComputedStyle(timeline).width; + audio.currentTime = parseInt((offsetX / parseInt(timelineWidth) * audio.duration).toString()); + }, false); + + + /** + * @function Click volume slider to change volume. + * @type {Element} + */ + const volumeSlider = audioPlayer.current.querySelector(".controls .volume-slider"); + volumeSlider.addEventListener('click', e => { + const sliderWidth = window.getComputedStyle(volumeSlider).width; + const newVolume = e.offsetX / parseInt(sliderWidth); + audio.volume = newVolume; + audioPlayer.current.querySelector(".controls .volume-percentage").style.width = newVolume * 100 + '%'; + }, false) + + /** + * @function Check audio percentage and update time accordingly. + */ + setInterval(() => { + if (audioPlayer.current) { + const progressBar = audioPlayer.current.querySelector(".progress"); + progressBar.style.width = audio.currentTime / audio.duration * 100 + "%"; + audioPlayer.current.querySelector(".time .current").textContent = getTimeCodeFromNum(audio.currentTime); + } + }, 500); + + + /** + * @function Toggle between playing and pausing on button click. + * @type {Element} + */ + const playBtn = audioPlayer.current.querySelector(".controls .toggle-play"); + playBtn.addEventListener( + "click", + () => { + if (audio.paused) { + playBtn.classList.remove("play"); + playBtn.classList.add("pause"); + audio.play(); + } else { + playBtn.classList.remove("pause"); + playBtn.classList.add("play"); + audio.pause(); + } + }, + false + ); + + audioPlayer.current.querySelector(".volume-button").addEventListener("click", () => { + const volumeEl = audioPlayer.current.querySelector(".volume-container .volume"); + audio.muted = !audio.muted; + if (audio.muted) { + volumeEl.classList.remove("icono-volumeMedium"); + volumeEl.classList.add("icono-volumeMute"); + } else { + volumeEl.classList.add("icono-volumeMedium"); + volumeEl.classList.remove("icono-volumeMute"); + } + }); + + /** + * @function Turns 128 seconds into 2:08 + * @param num + * @returns {string} + */ + function getTimeCodeFromNum(num) { + let seconds = parseInt(num); + let minutes = parseInt(seconds / 60); + seconds -= minutes * 60; + const hours = parseInt(minutes / 60); + minutes -= hours * 60; + + if (hours === 0) return `${minutes}:${String(seconds % 60).padStart(2, 0)}`; + return `${String(hours).padStart(2, 0)}:${minutes}:${String(seconds % 60 + ).padStart(2, 0)}`; + } + } + + render() { + return ( +
+
+
+
+
+
+
+
+
+
0:00
+
/
+
+
+
{this.name}
+
+
+
+
+ +
+
+
+
+
+
+ ); + } +} diff --git a/src/js/elements/DownloadButton.js b/src/js/elements/DownloadButton.js new file mode 100644 index 00000000..22835562 --- /dev/null +++ b/src/js/elements/DownloadButton.js @@ -0,0 +1,23 @@ +import React from 'react'; +import {HiOutlineDownload} from 'react-icons/hi'; + +import '../../css/download.css'; + +export class DownloadButton extends React.Component { + + constructor(props) { + super(props); + this.file = props.file; + this.url = process.env.APP_URL || 'http://localhost:5000/'; + } + + render() { + return ( + + ); + } +} diff --git a/src/js/elements/LoadingZone.js b/src/js/elements/LoadingZone.js new file mode 100644 index 00000000..ed552078 --- /dev/null +++ b/src/js/elements/LoadingZone.js @@ -0,0 +1,17 @@ +import React, {Component} from 'react'; + +import '../../css/styles.css'; +import '../../css/spinners.css'; + +export class LoadingZone extends Component { + render() { + return ( +
+
+
+
+
+
+ ); + } +} diff --git a/src/js/elements/NavigationBar.js b/src/js/elements/NavigationBar.js new file mode 100644 index 00000000..4fc11fd6 --- /dev/null +++ b/src/js/elements/NavigationBar.js @@ -0,0 +1,16 @@ +import React, {Component} from 'react'; + +import '../../css/styles.css'; + +export class NavigationBar extends Component { + render() { + return ( + + ); + } +} diff --git a/src/js/music-tagging/MusicTagging.js b/src/js/music-tagging/MusicTagging.js new file mode 100644 index 00000000..3f388faf --- /dev/null +++ b/src/js/music-tagging/MusicTagging.js @@ -0,0 +1,75 @@ +import React, {Component} from 'react'; +import {Container} from 'reactstrap'; +import '../../css/styles.css'; +import axios from "axios"; +import Jumbotron from 'react-bootstrap/Jumbotron' +import {AudioPlayer} from "../elements/AudioPlayer"; +import {LoadingZone} from "../elements/LoadingZone"; + + +export class MusicTagging extends Component { + static displayName = MusicTagging.name; + + constructor(props) { + super(props); + this.state = {source: null}; + this.url = process.env.APP_URL || 'http://localhost:5000/'; + } + + componentDidMount() { + this.setState({loading: true}, () => { + axios + .get(this.url + 'MusicTags', { + responseType: 'arraybuffer' + }) + .then(resp => { + const base64 = btoa( + new Uint8Array(resp.data).reduce( + (data, byte) => data + String.fromCharCode(byte), + '', + ), + ); + this.setState({ + loading: false, + data: "data:;base64," + base64 + }); + }); + }); + } + + render() { + const {data, loading} = this.state; + return ( + +
+

+ Music Tagging +

+ +

+ + + +
+ +
+ + {loading ? +
+ +
+ : + result + } +
+
+ +

+ +
+
+ ); + } +} diff --git a/src/js/stem-separation/FiveStems.js b/src/js/stem-separation/FiveStems.js new file mode 100644 index 00000000..0157a302 --- /dev/null +++ b/src/js/stem-separation/FiveStems.js @@ -0,0 +1,147 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; +import Jumbotron from 'react-bootstrap/Jumbotron' +import axios from "axios"; +import {AudioPlayer} from "../elements/AudioPlayer"; +import {LoadingZone} from "../elements/LoadingZone"; +import {DownloadButton} from "../elements/DownloadButton"; +import '../../css/styles.css'; + +export class FiveStems extends Component { + + constructor(props) { + super(props); + this.state = {source: null}; + this.url = process.env.APP_URL || 'http://localhost:5000/'; + } + + componentDidMount() { + this.setState({loading: true}, () => { + axios + .get(this.url + "GetFiveStems", null) + .then(resp => { + console.log(resp); + this.setState({ + loading: false, + }); + }) + }); + } + + render() { + const {loading} = this.state; + return ( + +
+ +

+ Five Stems +

+ +

+ + + +
+ +
+ + {loading ? + +
+ +
+
+ : + +
+
+
+
+
Vocals
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Bass
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Drums
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Piano
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Other
+
+
+
+ +
+
+
+ +
+
+
+ } + +
+ +

+ +
+
+ ); + } +} diff --git a/src/js/stem-separation/FourStems.js b/src/js/stem-separation/FourStems.js new file mode 100644 index 00000000..311d7803 --- /dev/null +++ b/src/js/stem-separation/FourStems.js @@ -0,0 +1,131 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; +import Jumbotron from 'react-bootstrap/Jumbotron' +import axios from "axios"; +import {AudioPlayer} from "../elements/AudioPlayer"; +import {LoadingZone} from "../elements/LoadingZone"; +import {DownloadButton} from "../elements/DownloadButton"; +import '../../css/styles.css'; + +export class FourStems extends Component { + + constructor(props) { + super(props); + this.state = {source: null}; + this.url = process.env.APP_URL || 'http://localhost:5000/'; + } + + componentDidMount() { + this.setState({loading: true}, () => { + axios + .get(this.url + "GetFourStems", null) + .then(resp => { + console.log(resp); + this.setState({ + loading: false, + }); + }) + }); + } + + render() { + const {loading} = this.state; + return ( + +
+ +

+ Four Stems +

+ +

+ + + +
+ +
+ {loading ? + +
+ +
+
+ : + +
+
+
+
+
Vocals
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Bass
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Drums
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Other
+
+
+
+ +
+
+
+ +
+
+ +
+ } + +
+ +

+ +
+
+ ); + } +} diff --git a/src/js/stem-separation/StemSeparation.js b/src/js/stem-separation/StemSeparation.js new file mode 100644 index 00000000..99b5504f --- /dev/null +++ b/src/js/stem-separation/StemSeparation.js @@ -0,0 +1,79 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; +import '../../css/styles.css'; + +const url = process.env.APP_URL || 'http://localhost:5000/'; + +export class StemSeparation extends Component { + + render() { + return ( + +
+ +

+ Stem Separation +

+ +
+
+
+
+
+
+ + +
Two Stems Separation
+
Vocal & Instrumentals
+
+ + {/*
*/} + {/* */} + {/*
*/} + + + +
Four Stems Separation
+
Vocal, Bass, Drums & Instrumentals
+
+ + {/*
*/} + {/* */} + {/*
*/} + + + +
Five Stems Separation
+
Vocal, Bass, Drums, Piano & Instrumentals
+
+ + {/*
*/} + {/* */} + {/*
*/} + +
+
+
+
+
+
+
+
+ ); + } +} diff --git a/src/js/stem-separation/TwoStems.js b/src/js/stem-separation/TwoStems.js new file mode 100644 index 00000000..f08257a3 --- /dev/null +++ b/src/js/stem-separation/TwoStems.js @@ -0,0 +1,98 @@ +import React, {Component} from 'react'; +import {Container} from 'react-bootstrap'; +import Jumbotron from 'react-bootstrap/Jumbotron' +import axios from "axios"; +import {AudioPlayer} from "../elements/AudioPlayer"; +import {LoadingZone} from "../elements/LoadingZone"; +import {DownloadButton} from "../elements/DownloadButton"; +import '../../css/styles.css'; + +export class TwoStems extends Component { + + constructor(props) { + super(props); + this.state = {source: null}; + this.url = process.env.APP_URL || 'http://localhost:5000/'; + } + + componentDidMount() { + this.setState({loading: true}, () => { + axios + .get(this.url + "GetTwoStems", null) + .then(resp => { + console.log(resp); + this.setState({ + loading: false, + }); + }) + }); + } + + render() { + const {loading} = this.state; + return ( + +
+ +

+ Two Stems +

+ +

+ + + +
+ +
+ + {loading ? + +
+ +
+
+ : + +
+
+
+
+
Vocals
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+
Instrumental
+
+
+
+ +
+
+
+ +
+
+
+ } +
+ +

+ +
+
+ ); + } +} diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js new file mode 100644 index 00000000..3bf9bd67 --- /dev/null +++ b/src/registerServiceWorker.js @@ -0,0 +1,109 @@ +// In production, we register a service worker to serve assets from local cache. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on the "N+1" visit to a page, since previously +// cached resources are updated in the background. + +// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. +// This link also includes instructions on opting out of this behavior. + +const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.1/8 is considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) +); + +export default function register() { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL(process.env.PUBLIC_URL, window.location); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 + return; + } + + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + + if (isLocalhost) { + // This is running on localhost. Lets check if a service worker still exists or not. + checkValidServiceWorker(swUrl); + } else { + // Is not local host. Just register service worker + registerValidSW(swUrl); + } + }); + } +} + +function registerValidSW(swUrl) { + navigator.serviceWorker + .register(swUrl) + .then(registration => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and + // the fresh content will have been added to the cache. + // It's the perfect time to display a "New content is + // available; please refresh." message in your web app. + console.log('New content is available; please refresh.'); + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); + } + } + }; + }; + }) + .catch(error => { + console.error('Error during service worker registration:', error); + }); +} + +function checkValidServiceWorker(swUrl) { + // Check if the service worker can be found. If it can't reload the page. + console.log('here....'); + fetch(swUrl) + .then(response => { + // Ensure service worker exists, and that we really are getting a JS file. + if ( + response.status === 404 || + response.headers.get('content-type').indexOf('javascript') === -1 + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(registration => { + registration.unregister().then(() => { + window.location.reload(); + }); + }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl); + } + }) + .catch(() => { + console.log( + 'No internet connection found. App is running in offline mode.' + ); + }); +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready.then(registration => { + registration.unregister(); + }); + } +} diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index cae503b9..00000000 --- a/tests/README.md +++ /dev/null @@ -1 +0,0 @@ -# Tests \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/test_main.py b/tests/test_main.py deleted file mode 100644 index 1475923e..00000000 --- a/tests/test_main.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -# coding: utf8 - -def test_main(): - pass diff --git a/website/assets/.gitkeep b/website/assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/website/css/styles.css b/website/css/styles.css deleted file mode 100644 index e69de29b..00000000 diff --git a/website/index.html b/website/index.html deleted file mode 100644 index 77f8c3bb..00000000 --- a/website/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - Apollo - - - - - - - - - -

Apollo

- - - \ No newline at end of file