Skip to content

Instantly share code, notes, and snippets.

View SarvagyaVaish's full-sized avatar

Survy Vaish SarvagyaVaish

View GitHub Profile
import cv2
import time
import numpy as np
IMG_SIZE = (250, 250)
NUM_ITERS = 500
def compare_tobytes_runtimes(img1, name1, img2, name2):
import cv2
import time
import numpy as np
IMG_SIZE = (250, 250)
NUM_ITERS = 500
def compare_tobytes_runtimes(img1, name1, img2, name2):
<iframe src="https://greatergood.berkeley.edu/quizzes/embed/empathy" width="100%" scrolling="no" id="iFrameResizer0" style="overflow: hidden; border:0;"></iframe>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://greatergood.berkeley.edu/quizzes/embedjs"></script>
bg_day 288 512 0.0 0.0 0.28125 0.5
bg_night 288 512 0.28515625 0.0 0.28125 0.5
bird0_0 48 48 0.0 0.9472656 0.046875 0.046875
bird0_1 48 48 0.0546875 0.9472656 0.046875 0.046875
bird0_2 48 48 0.109375 0.9472656 0.046875 0.046875
bird1_0 48 48 0.1640625 0.9472656 0.046875 0.046875
bird1_1 48 48 0.21875 0.6308594 0.046875 0.046875
bird1_2 48 48 0.21875 0.6816406 0.046875 0.046875
bird2_0 48 48 0.21875 0.7324219 0.046875 0.046875
bird2_1 48 48 0.21875 0.7832031 0.046875 0.046875
# Configuration #1
# Block all traffic FROM e1, e2, w1, w2
# Test #1:
# - run TCP server on e1
# [python test-tcp-server.py 10.0.0.1 1080]
# - run TCP client on e2 (e2 -> e1) - disallowed
# [python test-tcp-client.py 10.0.0.1 1080]
# - run TCP client on e3 (e3 -> e1) - disallowed
# [python test-tcp-client.py 10.0.0.1 1080]
# Test #2:
LMFunctor functor;
functor.m = m;
functor.n = n;
Eigen::LevenbergMarquardt<LMFunctor, float> lm(functor);
lm.minimize(x);
std::cout << "Optimization results" << std::endl;
std::cout << "\ta: " << x(0) << std::endl;
std::cout << "\tb: " << x(1) << std::endl;
// Compute the jacobian of the functions
int df(const Eigen::VectorXf &x, Eigen::MatrixXf &fjac) const
{
// 'x' has dimensions n x 1
// It contains the current estimates for the parameters.
// 'fjac' has dimensions m x n
// It will contain the jacobian of the errors, calculated numerically in this case.
float epsilon;
// Compute 'm' errors, one for each data point, for the given parameter values in 'x'
int operator()(const Eigen::VectorXf &x, Eigen::VectorXf &fvec) const
{
// 'x' has dimensions n x 1
// It contains the current estimates for the parameters.
// 'fvec' has dimensions m x 1
// It will contain the error for each data point.
float aParam = x(0);
struct LMFunctor
{
// Compute 'm' errors, one for each data point, for the given parameter values in 'x'
int operator()(const Eigen::VectorXf &x, Eigen::VectorXf &fvec) const
{
// TODO
}
// Compute the jacobian of the errors
int df(const Eigen::VectorXf &x, Eigen::MatrixXf &fjac) const
-10.00 -685.80
-9.50 -647.10
-9.00 -602.00
-8.50 -548.90
-8.00 -524.20
-7.50 -490.10
-7.00 -430.60
-6.50 -412.10
-6.00 -345.20
-5.50 -344.10