Skip to content

Instantly share code, notes, and snippets.

View maitchison's full-sized avatar

Matthew Aitchison maitchison

  • Canberra, Australia
View GitHub Profile
@maitchison
maitchison / ModelCRNN_Resnet.py
Last active May 18, 2023 05:07
Example of inserting RESNET-50 into a recurrent neural network.
# tensorflow-slim very nicely includes some prebuilt models for us to make use of.
from tensorflow.contrib.slim.nets import resnet_v2
class ModelCRNN_Resnet(ConvModel):
""" Recurrent Convolutional Neural Network based on resnet"""
MODEL_NAME = "model_resent"
MODEL_DESCRIPTION = "CNN + LSTM"
DEFAULT_PARAMS = {
import matplotlib.pyplot as plt
import numpy as np
gamma = 0.9
def true_return(rewards, terminals):
returns = []
acc = 0
for r, term in zip(rewards[::-1], terminals[::-1]):
acc = acc * gamma * (1-term) + r