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
# For Windows users# Note: <> denotes changes to be made | |
#Create a conda environment | |
conda create --name <environment-name> python=<version:2.7/3.5> | |
#Install dependency in existing environment | |
conda install -c conda-forge --name <env_name> scikit-plot ipython notebook numpy pandas scipy matplotlib seaborn scikit-learn scikit-plot Pillow scikit-image opencv joblib mlflow requests tensorflow keras dlib | |
#To create a requirements.txt file: | |
conda list #Gives you list of packages used for the environment |
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 matplotlib.pyplot import imshow | |
import numpy as np | |
import math | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.axes_grid1 import ImageGrid | |
from PIL import Image | |
import requests | |
from io import BytesIO | |
def show_images(images, cols = 1, titles = None): |
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
#!/usr/bin/python | |
from PIL import Image | |
import math | |
test_image_list = '/home/tianwei/Data/sfm_data/test_image_list' # path to the image list | |
with open(test_image_list, 'r') as f: | |
test_images = f.readlines() | |
test_images = map(str.strip, test_images) |
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
with detection_graph.as_default(): | |
with tf.Session(graph=detection_graph) as sess: | |
for image_path in TEST_IMAGE_PATHS: | |
image = Image.open(image_path) | |
image_np = load_image_into_numpy_array(image) | |
image_np_expanded = np.expand_dims(image_np, axis=0) | |
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0') | |
boxes = detection_graph.get_tensor_by_name('detection_boxes:0') | |
scores = detection_graph.get_tensor_by_name('detection_scores:0') | |
classes = detection_graph.get_tensor_by_name('detection_classes:0') |