Skip to content

Instantly share code, notes, and snippets.

import asyncio
import os
from concurrent.futures import ThreadPoolExecutor
import PySpin
BUFFER_SIZE = 1500
NUM_IMAGES = 4000 # The number of images to capture
NUM_SAVERS = 100 # The number of saver coroutines
# The directories to save to camera i will save images to SAVE_DIRS[i]
SAVE_DIRS = ['K:/Google Drive/Katz-Lab_Otter-Data/Projects/3D-Behavior/code/Test1','K:/Google Drive/Katz-Lab_Otter-Data/Projects/3D-Behavior/code/Test2']
# =============================================================================
# Copyright (c) 2001-2020 FLIR Systems, Inc. All Rights Reserved.
#
# This software is the confidential and proprietary information of FLIR
# Integrated Imaging Solutions, Inc. ("Confidential Information"). You
# shall not disclose such Confidential Information and shall use it only in
# accordance with the terms of the license agreement you entered into
# with FLIR Integrated Imaging Solutions, Inc. (FLIR).
#
# FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
Stream Buffer Count Mode set to manual...
Default Buffer Handling Mode: Oldest First
Default Buffer Count: 10
Maximum Buffer Count: 4308
Buffer count now set to: 3500
Now Buffer Handling Mode: Oldest First Overwrite
Stream Buffer Count Mode set to manual...
Default Buffer Handling Mode: Oldest First
NUM_IMAGES = 4000 # The number of images to capture
NUM_SAVERS = 10 # The number of saver coroutines
BUFFER_SIZE = 3500
# Set up cam_list and queue
system = PySpin.System.GetInstance()
cam_list = system.GetCameras()
queue = asyncio.Queue()
total_accuracy = 0.0
total_precision = 0.0
total_recall = 0.0
# Iterate over the cv and fit the decision tree using the training set
# https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.KFold.html
for i, (train_index, test_index) in enumerate(cv.split(X, Y)):
X_train, X_test = X[train_index], X[test_index]
y_train, y_test = Y[train_index], Y[test_index]
@josephbima
josephbima / features.py
Last active September 18, 2020 21:53
This code extracts the feature we have chosen from the data (window)
def _compute_mean_features(window):
"""
Computes the mean x, y and z acceleration over the given window.
"""
return np.mean(window, axis=0)
def _compute_std_features(window):
'''
Computes the standard deviation of x, y and z acceleration over the given window.