Skip to content

Instantly share code, notes, and snippets.

View ricardodeazambuja's full-sized avatar

Ricardo de Azambuja ricardodeazambuja

View GitHub Profile
@benjaminmgross
benjaminmgross / stats.py
Last active July 25, 2023 23:45
Predicted R-Squared (r2, r^2) Calculation in `python`
def press_statistic(y_true, y_pred, xs):
"""
Calculation of the `Press Statistics <https://www.otexts.org/1580>`_
"""
res = y_pred - y_true
hat = xs.dot(np.linalg.pinv(xs))
den = (1 - np.diagonal(hat))
sqr = np.square(res/den)
return sqr.sum()
@ByungSunBae
ByungSunBae / EditGraph.py
Created December 5, 2017 09:18
simple tensorflow graph edit example
# from : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/graph_editor/examples/edit_graph_example.py
import numpy as np
import tensorflow as tf
from tensorflow.contrib import graph_editor as ge
# create a graph
g = tf.Graph()
with g.as_default():
@EKami
EKami / tf-rasp.md
Last active September 23, 2022 03:28
Building TensorFlow for Raspberry Pi: a Step-By-Step Guide

Building TensorFlow 1.3.0-rc1 for Raspberry Pi/Ubuntu 16.04: a Step-By-Step Guide

Here you'll learn how to build Tensorflow for the raspberry pi 3 with either the Python API or as a standalone shared library which can be interfaced from the C++ API and eventually as a library which can be used in other languages.

For the C++ library this tutorial will show you how extract tensorflow library and headers to use in any environment you want.

(This tutorial couldn't be possible without the help of the people from the References section)

What You Need

@CarlosGS
CarlosGS / raspberry_fast_capture.py
Last active February 26, 2024 04:16
Fast reading from the raspberry camera with Python, Numpy, and OpenCV. See the comments for more details.
# Fast reading from the raspberry camera with Python, Numpy, and OpenCV
# Allows to process grayscale video up to 124 FPS (tested in Raspberry Zero Wifi with V2.1 camera)
#
# Made by @CarlosGS in May 2017
# Club de Robotica - Universidad Autonoma de Madrid
# http://crm.ii.uam.es/
# License: Public Domain, attribution appreciated
import cv2
import numpy as np
@stared
stared / live_loss_plot_keras.ipynb
Last active February 25, 2023 10:20
Live loss plot for training models in Keras (see: https://github.com/stared/livelossplot/ for a library)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sunsided
sunsided / dump_operations.py
Last active October 27, 2021 21:26
Listing operations in frozen .pb TensorFlow graphs in GraphDef format (see comments for SavedModel)
import argparse
import os
import sys
from typing import Iterable
import tensorflow as tf
parser = argparse.ArgumentParser()
parser.add_argument('file', type=str, help='The file name of the frozen graph.')
args = parser.parse_args()
@fm4dd
fm4dd / gcc compiler optimization for arm systems.md
Last active April 9, 2024 19:24
GCC compiler optimization for ARM-based systems

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

@stefanbuck
stefanbuck / upload-github-release-asset.sh
Last active November 26, 2023 12:40
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
@Ashwinning
Ashwinning / HowToOpenAnotherTerminal-BashInstanceInARunningDockerContainer.md
Last active February 17, 2022 18:26
How To Open Another Terminal/Bash Instance In A Running Docker Container #gistblog #bash #docker

How To Open Another Terminal/Bash Instance In A Running Docker Container

Add the following to your bashrc.

#Add another docker window
function dock()
{
  if [ "$1" == "-h" ]
 then