Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

lp6m

🏠
Working from home
  • Kyoto -> Tokyo
View GitHub Profile
View binary_mnist.cpp
#include <bits/stdc++.h>
using namespace std;
float binarize(float x){
float xx = 0.5f * x + 0.5f;
xx = min(max(xx, 0.0f), 1.0f);
return (xx >= 0.5f) ? 1.0f : -1.0f;
}
View dmesg.txt
[ 80.692879] fpga_manager fpga0: writing fpga.bin to Xilinx ZynqMP FPGA Manager
[ 81.067722] ------------[ cut here ]------------
[ 81.067749] WARNING: CPU: 3 PID: 3493 at /kernel-source//drivers/clk/clk.c:622 clk_core_disable+0x88/0x90
[ 81.067752] Modules linked in: fclkcfg(O) mali(O) uio_pdrv_genirq
[ 81.067770] CPU: 3 PID: 3493 Comm: cp Tainted: G O 4.14.0-xilinx-v2018.2 #1
[ 81.067772] Hardware name: ZynqMP ZCU100 RevC (DT)
[ 81.067774] task: ffffffc06d294180 task.stack: ffffff800e670000
[ 81.067779] PC is at clk_core_disable+0x88/0x90
[ 81.067784] LR is at clk_core_disable_lock+0x20/0x38
[ 81.067786] pc : [<ffffff80084b47c8>] lr : [<ffffff80084b47f0>] pstate: 800001c5
View dpu_system.dts
/dts-v1/;
/ {
compatible = "xlnx,zynqmp-zcu100-revC", "xlnx,zynqmp-zcu100", "xlnx,zynqmp";
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "ZynqMP ZCU100 RevC";
cpus {
#address-cells = <0x1>;
@lp6m
lp6m / generate_sample.R
Created Nov 7, 2019
Generate bayesian network sample data from learned network structure on R
View generate_sample.R
#sudo apt install r-base-core #the latest version will not be installed by this command
#install.packages("bnlearn", dependencies = TRUE)
library(bnlearn)
data(alarm)
res = read.bif("./alarm.bif") #http://www.bnlearn.com/bnrepository/discrete-medium.html#alarm
sim = rbn(res, 500, alarm)
write.csv(sim, "./alarm.csv")
View bdeu_score.cpp
/*example dataset
4 3
A B C D
A B
B C
D C
10
1 1 0 1
0 2 1 1
2 1 0 0
View build-ubuntu18.04-rootfs.sh
#This shell script refers this tip : https://qiita.com/ikwzm/items/be06b07e26cbf05fec2b
#rootfs which this script generates is compatible for v2019.1 of https://github.com/ikwzm/ZynqMP-FPGA-Linux
#### Setup APT
distro=bionic
export LANG=C
/debootstrap/debootstrap --second-stage
View dma.h
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/mman.h>
#define DMA_INTAKE_DMACR (0x0000)
View hog.cpp
void hog(cv::Mat img, double *dst){
const int s_row = 32;//img.rows;
const int s_col = 64;//img.cols;
const int c_row = 12;
const int c_col = 12;
const int b_row = 2;
const int b_col = 2;
int n_cells_row = s_row / c_row; // number of cells along row-axis //2
int n_cells_col = s_col / c_col; // number of cells along col-axis //5
const int orientations = 8;
View gist:9a492fbae3a288716d3ed6dd64567772
void hog(cv::Mat img, double *dst){
const int s_row = 32;//img.rows;
const int s_col = 64;//img.cols;
const int c_row = 12;
const int c_col = 12;
const int b_row = 2;
const int b_col = 2;
int n_cells_row = s_row / c_row; // number of cells along row-axis //2
int n_cells_col = s_col / c_col; // number of cells along col-axis //5
const int orientations = 8;
You can’t perform that action at this time.