This file contains hidden or 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 multiprocessing | |
import threading | |
from concurrent import futures | |
import random | |
max_workers = multiprocessing.cpu_count() - 2 | |
def compute(): | |
return sum( | |
[random.randint(1, 100) for i in range(1000000)]) | |
This file contains hidden or 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
''' | |
modeling_preparation.py | |
''' | |
from .project_imports import * | |
from .utilties import * | |
from .model_store import * | |
def train_val_test_split(trainable_df, train_percent, val_percent, | |
test_percent): |
This file contains hidden or 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
def intialise_model(weight_path): | |
return model_obj | |
class Inference(): | |
def __init__(self,weight_path): | |
self.model_obj = None | |
self.weight_path = weight_path | |
def __load_model(self): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 pandas as pd | |
import numpy as np | |
import cv2 | |
import os | |
from PIL import Image | |
import glob | |
from keras.applications.inception_v3 import InceptionV3 | |
from keras.applications.inception_v3 import preprocess_input, decode_predictions |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
from concurrent.futures import ProcessPoolExecutor, as_completed | |
import cv2 | |
import multiprocessing | |
import os | |
import sys | |
def print_progress(iteration, total, prefix='', suffix='', decimals=3, bar_length=100): | |
""" | |
Call in a loop to create standard out progress bar |
This file contains hidden or 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 numpy as np | |
import json | |
import base64 | |
encode_array = lambda nparray : [str(nparray.dtype.name), nparray.tobytes(), nparray.shape] | |
def decode_array(encStr): | |
#get the encoded json dump | |
enc = encStr | |
# build the numpy data type | |
dataType = np.dtype(enc[0]) |
This file contains hidden or 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
## Plotting the compressed feature | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import colors as mcolors | |
import seaborn as sns | |
### 2D | |
compressed_frame = pd.DataFrame(indexing_features,columns=['x','y','z']) |
This file contains hidden or 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
from PIL import Image | |
def check_image_with_pil(path): | |
try: | |
Image.open(path) | |
except IOError: | |
return False | |
return True |
NewerOlder