Skip to content

Instantly share code, notes, and snippets.

💭
too much of work

Patrice Ferlet metal3d

💭
too much of work
Block or report user

Report or block metal3d

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@metal3d
metal3d / videoframegenerator.py
Last active Apr 3, 2019
A video frame generator respecting Keras.Sequence class with data augmentation capacities
View videoframegenerator.py
import keras
import cv2 as cv
import glob
import numpy as np
import os
import random
import math
# author: Patrice Ferlet <patrice.ferlet@smile.fr>
# licence: MIT
@metal3d
metal3d / videoframegenerator.py
Created Apr 2, 2019
A video frame generator respecting Keras.Sequence class with data augmentation capacities
View videoframegenerator.py
import keras
import cv2 as cv
import glob
import numpy as np
import os
import random
import keras_preprocessing
# author: Patrice Ferlet <patrice.ferlet@smile.fr>
# licence: MIT
View TF - graph exemple.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View tfboardviewer.py
import tensorflow as tf
import numpy as np
from IPython.display import clear_output, Image, display, HTML
def strip_consts(graph_def, max_const_size=32):
"""Strip large constant values from graph_def."""
strip_def = tf.GraphDef()
for n0 in graph_def.node:
n = strip_def.node.add()
n.MergeFrom(n0)
@metal3d
metal3d / generator.py
Last active Nov 29, 2018
Keras generator to create sequence image batches
View generator.py
import cv2 as cv
import os
import glob
import numpy as np
import random
class VideoFrameGenerator():
def __init__(self,
nbframe:int=5,
@metal3d
metal3d / make_prediction.py
Last active Nov 28, 2018
Keras make prediction on image sequence
View make_prediction.py
from IPython.display import HTML, display
import cv2 as cv
import os
import matplotlib.pyplot as plt
def make_prediction(model, movie, nframe, classes, shape=(224, 224), nchan=3):
video = cv.VideoCapture(movie)
frames = []
while True:
grabbed, frame = video.read()
@metal3d
metal3d / function.yaml
Created Sep 10, 2018
Simple Keras model loader and prediction handler for Nuclio
View function.yaml
apiVersion: "nuclio.io/v1beta1"
kind: "Function"
spec:
runtime: "python:3.6"
handler: main:handler
minReplicas: 1
maxReplicas: 1
build:
baseImage: python:3.6-jessie
@metal3d
metal3d / dlblender
Created Sep 8, 2018
Download latest Blender builds
View dlblender
#!/bin/env python3
# -*- encoding: utf8 -*-
"""
Download latest build for Blender 2.7x and 2.8x
How to use:
- get that source code and name it "dlblender"
- change vars INSTALL_PATH and LINK_PATH is you want
- INSTALL_PATH is where will reside new and old version of blender.
I'm using hidden path "~/.blender"
@metal3d
metal3d / predictor.py
Created Jun 7, 2018
Sagmaker prediction
View predictor.py
from sagemaker.predictor import RealTimePredictor
from sagemaker.predictor import json_serializer
# get the name in SageMaker interface and put it there
endpoint = 'name of your endpoint'
# you can use other serializer, or none if you are able
# to get data in binary format
predictor = RealTimePredictor(endpoint, serializer=json_serializer)
@metal3d
metal3d / estimator.py
Last active Jun 7, 2018
Sagemaker estimator
View estimator.py
import sagemaker as sage
import boto3
from sagemaker import get_execution_role
role = get_execution_role()
sess = sage.Session()
account = sess.boto_session.client('sts').get_caller_identity()['Account']
region = sess.boto_session.region_name # or setup the region by hand
You can’t perform that action at this time.