For model details, see our paper on arXiv: Onsets and Frames: Dual-Objective Piano Transcription
First, set up your Magenta environment. Next, you can either use a pre-trained model or train your own.
First, you'll need to download a copy of the MAPS Database. Unzip the MAPS zip files after you've downloaded them.
Next, you'll need to create TFRecord files that contain the relevant data from MAPS by running the following command:
MAPS_DIR=<path to directory containing unzipped MAPS dataset>
OUTPUT_DIR=<path where the output TFRecord files should be stored>
onsets_frames_transcription_create_dataset \
--input_dir="${MAPS_DIR}" \
--output_dir="${OUTPUT_DIR}"
To try inference right away, you can use the checkpoint we used for the results in our paper: checkpoint.zip. After unzipping that checkpoint, you can run the following command:
CHECKPOINT_DIR=<path to unzipped checkpoint>
TEST_EXAMPLES=<path to maps_config2_test.tfrecord generated during dataset creation>
RUN_DIR=<path where output should be saved>
onsets_frames_transcription_infer \
--acoustic_run_dir="${CHECKPOINT_DIR} \
--examples_path="${TEST_EXAMPLES}" \
--run_dir="${RUN_DIR}"
You can check on the metrics resulting from inference using TensorBoard:
tensorboard --logdir="${RUN_DIR}"
You can train your own transcription model using the training TFRecord file generated during dataset creation.
TRAIN_EXAMPLES=<path to maps_config2_train.tfrecord generated during dataset creation>
RUN_DIR=<path where checkpoints and summary events should be saved>
onsets_frames_transcription_train \
--examples_path="${TRAIN_EXAMPLES}" \
--run_dir="${RUN_DIR}" \
--mode='train'
You can also run an eval job during training to check approximate metrics:
TEST_EXAMPLES=<path to maps_config2_test.tfrecord generated during dataset creation>
RUN_DIR=<path where checkpoints should be loaded and summary events should be saved>
onsets_frames_transcription_train \
--examples_path="${TRAIN_EXAMPLES}" \
--run_dir="${RUN_DIR}" \
--mode='eval'
During training, you can check on progress using TensorBoard:
tensorboard --logdir="${RUN_DIR}"