Class OrcaSpotWorkerExe

java.lang.Object
rawDeepLearningClassifier.dlClassification.orcaSpot.OrcaSpotWorkerExe

public class OrcaSpotWorkerExe extends Object
Executes the Orca Spot deep learning classifier from a python.exe file and python scripts. Getting this to work is not a simple process.

A temporary wav file is written from current audio data. Python code is then executed which reads the python.exe file and runs scripts which us a deep learning model to detect whether there is an Orca in the audio data. A result is then returned.

This a clunky way of doing this however serves as a prototype for a more integrated approach in future.

Prerequisites

  • The OrcaSpot folder with required scripts and models. Script paths are located in OrcaSpotParmas
  • Python and Anaconda or similar installed.
  • Cuda installed from Nvidea.
  • Cuda support for Pytorch installed.

To set up the python environment properly

  • Open command prompt or Anaconda prompt if is using Anaconda.
  • Type python -m venv C:\Your\Enviroment\Path\Here for Example python -m venv C:\Users\Hauec\Desktop\Segmenter\pytorch\my-venv. This creates a Folder called my-venv in the PyTorch Folder inside of the Segmenter.
  • Next you need to activate your Virtual environment. Inside of my-venv\Scripts should see a windows batch called activate.bat. cd to it and run it in CMD. You'll know that it is active via the (my-venv) precommand.
  • Once that is done, run setup_pytorch.bat from the PyTorch folder. It should automatically install Pytorch, PyVision, and all of the required dependencies. With the exception of pywin32 and pypiwin32. Both of them need to installed manually through pip. e.g. pip install pywin32, pypiwin32
Author:
Christopher Hauer, Jamie Macaulay
  • Constructor Details

    • OrcaSpotWorkerExe

      public OrcaSpotWorkerExe()
      Constructor for OrcaSpot classifier
  • Method Details

    • runOrcaSporClassifier

      public void runOrcaSporClassifier(double[][] audioData, float sampleRate, OrcaSpotParams orcaSpotParams)
    • is_orca

      public boolean is_orca(String prediction_line)
      Check whether the output indicates this is an orca or not.
      Parameters:
      prediction_line - - the prediciton string from the classifier output/
      Returns:
      true if an orca is classified.
    • main

      public static void main(String[] args)
      Test the algorithm!
      Parameters:
      args - - input arguments