Skip to content

Instantly share code, notes, and snippets.

@iwatake2222
iwatake2222 / OpenCV_with_CUDA_install_Jetson.sh
Created September 12, 2020 13:25
OpenCV_with_CUDA_install_Jetson.sh
### System update and install minimum tools ###
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install nano python-pip
sudo -H pip install -U jetson-stats
### Install other libs ###
sudo apt -y install ffmpeg libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libavresample-dev
sudo apt -y install libvorbis-dev libxvidcore-dev libx264-dev libxvidcore-dev
sudo apt -y install libgtk2.0-dev libgtk-3-dev
@iwatake2222
iwatake2222 / Accessing shared memory from different core Result
Last active August 8, 2020 13:16
Accessing shared memory from different core
pi@raspberrypi:~/multi/build $ ./main
total num = 10000000
cntx0y0 = 47 (0.0000047000)
cntx1y1 = 9893013 (0.9893013000)
cntx1y0 = 4 (0.0000004000)
cntx0y1 = 106935 (0.0106935000)
@iwatake2222
iwatake2222 / edgetpucompile.ipynb
Created May 9, 2020 11:55
EdgeTPUCompile.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iwatake2222
iwatake2222 / makefulluseofedgetpu.ipynb
Created May 9, 2020 11:51
MakeFullUseOfEdgeTPU.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iwatake2222
iwatake2222 / Build_tensorflowlite.dll_.sh
Last active January 17, 2022 10:34
How to generate tensorflowlite.dll for Visual Studio (Windows)
# On Git Bash
cd path-to-tensorflow
git checkout 00cb358ab2e67d0b06a21901ded13c57fd47e673
./tensorflow/lite/tools/make/download_dependencies.sh
nano tensorflow/lite/build_def.bzl
###
# --- a/tensorflow/lite/build_def.bzl
# +++ b/tensorflow/lite/build_def.bzl
# @@ -159,6 +159,7 @@ def tflite_cc_shared_object(
@iwatake2222
iwatake2222 / install_opencv_centos7.sh
Last active September 9, 2019 15:28
Installing OpenCV4 on Cent OS 7 (AWS)
# Preparation
sudo yum upgrade
sudo yum -y groupinstall "Development Tools"
sudo yum install -y wget autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel gtk3 gtk3-devel
sudo yum install -y git gcc bzip2 bzip2-devel openssl openssl-devel readline readline-devel sqlite-devel
sudo yum install -y cmake libjpeg-devel libtiff-devel libpng-devel jasper-devel
sudo yum install -y mesa-libGL-devel libXt-devel libgphoto2-devel nasm libtheora-devel
sudo yum install -y autoconf automake gcc-c++ libtool yasm openal-devel blas blas-devel atlas atlas-devel lapack lapack-devel
sudo yum install -y tbb-devel
@iwatake2222
iwatake2222 / install_opencv_raspberry_pi3.py
Last active December 8, 2019 13:03
install_opencv_raspberry_pi
### バージョンチェック ###
python3
import cv2
cv2.__version__
print(cv2.getBuildInformation())
### 依存パッケージのインストール ###
# 古いイメージだと、1回目のupdateでエラーが出るかも。気にせずupgradeして、再度update,upgradesudo する
sudo apt update
@iwatake2222
iwatake2222 / detection_PC.py
Last active October 10, 2023 21:58
Object detection using MobileNet SSD with tensorflow lite (with and without Edge TPU)
# -*- coding: utf-8 -*-
import cv2
import tensorflow as tf
import numpy as np
# https://www.tensorflow.org/lite/guide/hosted_models
# http://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip
def detect_from_camera():
@iwatake2222
iwatake2222 / conv.cpp
Last active April 11, 2022 03:26
OpenCV色フォーマット変換(BGR,YUV420, NV12)
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
void save(const char *filename, const unsigned char * data, int size)
{
FILE *fp = fopen(filename, "wb");
fwrite(data, size, 1, fp);
fclose(fp);
@iwatake2222
iwatake2222 / create_graph_for_tensorboard.py
Created May 3, 2019 13:48
TensorFlowモデル(pb)の構造を見る
import tensorflow as tf
with tf.Session() as sess:
with tf.gfile.GFile('conv_mnist.pb', 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
g_in = tf.import_graph_def(graph_def)
train_writer = tf.summary.FileWriter('logs')
train_writer.add_graph(sess.graph)