Skip to content

Instantly share code, notes, and snippets.

View salman-ghauri's full-sized avatar

Salman Ghauri salman-ghauri

  • Pakistan
View GitHub Profile
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import Dropout, Flatten, Dense, GlobalAveragePooling2D
from keras import backend as k
from keras.callbacks import ModelCheckpoint, LearningRateScheduler, TensorBoard, EarlyStopping
img_width, img_height = 256, 256
import tensorflow as tf
# Assuming object detection API is available for use
from object_detection.utils.config_util import create_pipeline_proto_from_configs
from object_detection.utils.config_util import get_configs_from_pipeline_file
import object_detection.tf_server_export_inference_graph
# Configuration for model to be exported, the pipeline_config_path
config_pathname = "custom_detection/configs/101resnet_frcnn_coco.config"
"""Functions to export object detection inference graph."""
import logging
import os
import tempfile
import tensorflow as tf
from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.client import session
from tensorflow.python.framework import graph_util
from tensorflow.python.platform import gfile
"""A simple GRPC client to communicate with tf-server on the given port.
It has been developed by some help from another GIST which I forgot to reference."""
import time
from argparse import ArgumentParser
from grpc.beta import implementations
from tensorflow_serving.apis import predict_pb2
from tensorflow_serving.apis import prediction_service_pb2
from tensorflow.contrib.util import make_tensor_proto
import grpc
import scipy
@salman-ghauri
salman-ghauri / models.conf
Last active January 9, 2019 15:36
DockerFile for creating a tensorflow server container by adding models in the path and running it on specified ports.
model_config_list: {
config: {
name: "resnet_101",
base_path: "/models/res2",
model_platform: "tensorflow",
model_version_policy: {
specific: {
versions: 1
}
s = class_descriptions[class_descriptions['class']\
.isin(classes)]\
.set_index('name').T.to_dict()
train_df = pd.DataFrame(columns=['FileName', 'XMin', 'XMax',
'YMin', 'YMax',
'ClassName'])
# Find boxes in each image and put them in a dataframe
train_imgs = os.listdir(train_path)
train_imgs = [name[0:16] for name in train_imgs\
@salman-ghauri
salman-ghauri / get_birds_eye.py
Last active October 4, 2018 12:16
Download Bing Map Bird's Eye Images. (High resolution)
"""
Use this code to download High resolution Birds Eye view which is similar to Google map's 45° imagery. There is no straight
forward way to download either of these.
"""
import urllib
import json, sys
from PIL import Image
from io import BytesIO
latlon = sys.argv[1]
License Key PhpStorm 8
User Name : EMBRACE
===== LICENSE BEGIN =====
43136-12042010
00002UsvSON704l"dILe1PVx3y4"B3
49AU6oSDJrsjE8nMOQh"8HTDJHIUUh
gd1BebYc5U"6OxDbVsALB4Eb10PW8"
===== LICENSE END =====