This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy | |
from random import randint | |
from PIL import Image | |
# Get all the image files' path. | |
homePath = "./images" | |
# Define locations for different type of data. | |
for dir_parent in ["train", "test"]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original code here: | |
# https://github.com/opencv/opencv/blob/master/samples/python/video_threaded.py | |
#!/usr/bin/env python3 | |
''' | |
Multithreaded video processing minimal sample. | |
Usage: | |
python3 video_threaded.py | |
Shows how python threading capabilities can be used |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
read() and grab() in OpenCV VideoCapture takes different time as there is no | |
decoding for grab() operation. Let's try to find out how much these two methods | |
differs. | |
""" | |
import cv2 | |
def main(): | |
tm = cv2.TickMeter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
DURATION = 12 | |
FPS = 25 | |
START = 0 | |
STEPS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] | |
if __name__ == "__main__": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Minimal example showing how to generate TensorFlow TFRecord file.""" | |
import tensorflow as tf | |
tf.enable_eager_execution() | |
# All raw values should be converted to a type compatible with tf.Example. Use | |
# the following functions to do these convertions. | |
def _bytes_feature(value): | |
"""Returns a bytes_list from a string / byte.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
MODEL_PATH = '/home/robin/Desktop/arc_inf/1554262166' | |
IMAGE_PATH = '/data/dataset/public/ms_celeb_1m/arc_face_data/img/0/0.jpg' | |
with tf.Session(graph=tf.Graph()) as sess: | |
# Restore model from the saved_modle file, that is exported by TensorFlow estimator. | |
tf.saved_model.loader.load(sess, ["serve"], MODEL_PATH) | |
# Get the output node from the graph. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Imports a SavedModel as a graph in Tensorboard.""" | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
import argparse | |
import sys | |
from tensorflow.core.framework import graph_pb2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import cv2 | |
import matplotlib | |
from matplotlib import animation, pyplot | |
from mpl_toolkits.mplot3d import Axes3D | |
# The module mesh_detector could be found here: | |
# https://github.com/yinguobing/head-pose-estimation/tree/google-face-mesh | |
from mesh_detector import MeshDetector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Template code for video frame processing. | |
Features: | |
- video source from files or webcams. | |
- automatically flip the frame if reading from webcam. | |
- built in video writer to output the processed result. | |
- built in FPS metter. | |
For more: https://github.com/yinguobing | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=0 | |
for i in * | |
do | |
if [ $((n+=1)) -gt 50 ]; then | |
n=1 | |
fi | |
todir=../my_file$n | |
[ -d "$todir" ] || mkdir "$todir" | |
mv "$i" "$todir" | |
done |