This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
#include <string> | |
#include <vector> | |
// Forward declarations | |
class NoAnnotation; | |
template<typename A = NoAnnotation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NumericTypeValue | |
{ | |
public: | |
NumericTypeValue(float value) : m_Value(double{value}){} | |
NumericTypeValue(double value) : m_Value(value){} | |
NumericTypeValue(int value): m_Value(int64_t{value}){} | |
NumericTypeValue(unsigned int value): m_Value(uint64_t{value}){} | |
NumericTypeValue(uint64_t value): m_Value(value){} | |
NumericTypeValue(int64_t value): m_Value(value){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import os | |
import sys | |
import csv | |
def get_box_centre(box): | |
return (int(box[0] + (box[2] / 2)), int(box[1] + (box[3] / 2))) | |
def draw_box(frame, box, colour): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import os | |
import sys | |
import csv | |
def draw_box(frame, box, colour): | |
(x, y, w, h) = (int(v) for v in box) | |
cv2.rectangle(frame, (x, y), (x + w, y + h), colour, 2) | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create sequential model | |
model = SequentialModel() | |
with model: | |
input = InputLayer(IntegrateFireInput(v_thresh=5.0), 784) | |
Layer(Dense(weight=weights[0]), IntegrateFire(v_thresh=5.0)) | |
Layer(Dense(weight=weights[1]), IntegrateFire(v_thresh=5.0, output=SpikeCount())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from os import path | |
from ml_genn import InputLayer, Layer, SequentialModel | |
from ml_genn.compilers import Compiler | |
from ml_genn.neurons import IntegrateFire, IntegrateFireInput | |
from ml_genn.connectivity import Dense | |
# Load weights | |
weights = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
spikes = np.loadtxt("spikes.csv", delimiter=",") | |
voltages = np.loadtxt("voltages.csv", delimiter=",") | |
fig, axes = plt.subplots(5, sharex=True) | |
for i in range(4): | |
axes[i].plot(voltages[:,0], voltages[:,i+1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++ includes | |
#include <algorithm> | |
#include <fstream> | |
// ------------------------------------------------------------------------ | |
// Helper macro for error-checking CUDA calls | |
#define CHECK_CUDA_ERRORS(call) {\ | |
cudaError_t error = call;\ | |
if (error != cudaSuccess) {\ | |
throw std::runtime_error(__FILE__": " + std::to_string(__LINE__) + ": cuda error " + std::to_string(error) + ": " + cudaGetErrorString(error));\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, pathlib | |
import tensorflow as tf | |
from tensorflow.keras import (models, layers, datasets, callbacks, optimizers, | |
initializers, regularizers) | |
from tensorflow.keras.utils import CustomObjectScope | |
from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
from glob import glob | |
import numpy as np | |
# Learning rate schedule |
NewerOlder