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
sometimes = lambda aug: iaa.Sometimes(0.5, aug) | |
# Define our sequence of augmentation steps that will be applied to every image | |
# All augmenters with per_channel=0.5 will sample one value _per image_ | |
# in 50% of all cases. In all other cases they will sample new values | |
# _per channel_. | |
seq = iaa.Sequential( | |
[ | |
# apply the following augmenters to most images | |
iaa.Fliplr(0.5), # horizontally flip 50% of all images | |
iaa.Flipud(0.2), # vertically flip 50% of all 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: | |
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0') | |
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0') | |
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0') | |
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0') | |
num_detections = detection_graph.get_tensor_by_name('num_detections:0') | |
for image_path in TEST_IMAGE_PATHS: | |
image = Image.open(image_path) | |
image_np = load_image_into_numpy_array(image) |
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
model { | |
faster_rcnn { | |
num_classes: 4 | |
image_resizer { | |
keep_aspect_ratio_resizer { | |
height: 600 | |
width: 600 | |
} | |
} | |
feature_extractor { |
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 matplotlib.pyplot as plt | |
import matplotlib.patches as patches | |
from PIL import Image | |
import numpy as np | |
input_test_img = '/your/path/Utah_AGRC-HRO_15.0cm_12TVK220980-CROP.0.0.jpg' | |
im = np.array(Image.open(input_test_img), dtype=np.uint8) | |
# Create figure and axes | |
fig,ax = plt.subplots(figsize=(10, 10)) |