##Softwares / packages be installed on the Raspberry Pi 5 board for the RaCAM_IS software to work:


##Install python packages:

##-Open a new terminal window, then run:

sudo apt update
sudo apt upgrade
sudo apt install python3-pip
sudo apt install python3-tk
sudo apt install python3-pil
sudo apt install python3-pil.imagetk



##Download the "Racam_IS_software.zip" and "ResNet50_EoceneRadiolaria.zip" files from https://github.com/microfossil/particle-classification-onnx: 

##-Unzip the "Racam_IS_software.zip" file on your Desktop and ensure that the "RaCAM_IS" file, and "/RaCAM_IS_files/" and "/RaCAM_IS_output/" folders are located on your Desktop.
###-Unzip the "ResNet50_EoceneRadiolaria.zip" file and place the "ResNet50_EoceneRadiolaria" folder in the "/RaCAM_IS_files/CNN_models/" directory.
##-Navigate to the "/RaCAM_IS_files/" directory located on your Desktop, right-click on the RaCAM_IS.py file and select "Thonny" as default application to open this type of file.
##-Right click on the "RaCAM_IS" file located on your Desktop to open it with a text editor, and update lines 3 (Exec=) and 4 (Icon=) by replacing <user> by your OS username (two times total), and save it. You should enter the username profile currently in use, and that can be found by looking at the path to the Desktop directory (e.g.: "/home/<user>/Desktop/"). You should now see the "RaCAM_IS" file icon as a RaCAM camera after a restart of the system.
##-Double-click on it to start the "RaCAM_IS" software, you will be prompt to enter your username for updating paths for running the software. You should enter the username profile currently in use, and that can be found by looking at the path to the Desktop directory (e.g.: "/home/<user>/Desktop/").
##-Once validated, the software should start successfully and you should be able to see the user interface. The "RaCAM_IS" software can now be closed as other software and packages are required before using it.
##-Check if camera is detected and working properly by opening a new terminal window then running:

rpicam-hello --timeout 0

##Then you can use "Ctrl+C" in the terminal window, or simply the close button on the preview window to stop rpicam-hello.



##Install ImageJ:

##-Install ImageJ from "Application menu bar": "Preferences": "Add / Remove software" and look for "Image processing program with a focus on microscopy images" and "Java library for ImageJ". Select both of them then click "Ok".
##-Start it in "Application menu bar" under "Education".
##-Navigate to "/home/<user>/". Press "ctrl+h" to show hidden files and folders.
##-Open a file manager window, navigate to the "Edit" menu: "Preferences" and select "Don't ask option on launch of executable files" in the "General" tab.
##-Go into the "home/<user>/.imagej/" directory.
##-Copy the "AutoRadio_RaCAMx10.ijm" and "Adjustable_Watershed.class" files (located in /home/<user>/Desktop/RaCAM_IS_files/imagej_plugins/) into the "/home/<user>/.imagej/macros/" and "/home/<user>/.imagej/plugins/", respectively.



##Download and install Miniconda3:

##-Open a new terminal window, then run and follow instructions during Miniconda3 installation. Answer "yes" to the licence terms, and install it in the default location ("/home/<user>/miniconda3/"), and answer "yes" when ask to proceed to initilisation:

wget repo.anaconda.com
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
bash ~/Miniconda3-latest-Linux-aarch64.sh



##Install packages in Miniconda3 environment:

##-Open a new terminal window, then run and accept main terms of service and proceed to installation:

conda create -n miso-onnx python=3.11
conda activate miso-onnx
pip install opencv-python
pip install numpy
pip install torch
pip install pillow
pip install onnxruntime
pip install git+https://github.com/microfossil/particle-classification-onnx



##-Check if miso-onnx installation is successfull by running:

miso-onnx classify --network-info /home/<user>/Desktop/RaCAM_IS_files/CNN_models/ResNet50_EoceneRadiolaria/model_onnx/network_info.xml --images /home/<user>/Desktop/RaCAM_IS_files/CNN_models/ResNet50_EoceneRadiolaria/simple_test/unlabeled_images --output-csv /home/<user>/Desktop/RaCAM_IS_files/CNN_models/ResNet50_EoceneRadiolaria/simple_test/prediction_file/predictions.csv

##-This should generate a csv file located in "/RaCAM_IS_files/CNN_models/ResNet50_EoceneRadiolaria/simple_test/prediction_file/"
##For more information about the use of onnx model for recognition workflow, visit: https://github.com/microfossil/particle-classification-onnx
