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
| class InferenceConfig(config.__class__): | |
| # Run detection on one image at a time | |
| GPU_COUNT = 1 | |
| IMAGES_PER_GPU = 1 | |
| DETECTION_MIN_CONFIDENCE = 0.95 | |
| DETECTION_NMS_THRESHOLD = 0.0 | |
| IMAGE_MIN_DIM = 768 | |
| IMAGE_MAX_DIM = 768 | |
| RPN_ANCHOR_SCALES = (64, 96, 128, 256, 512) | |
| DETECTION_MAX_INSTANCES = 20 |
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 nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 | |
| MAINTAINER Gabriel Garza <garzagabriel@gmail.com> | |
| # Essentials: developer tools, build tools, OpenBLAS | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| apt-utils git curl vim unzip openssh-client wget \ | |
| build-essential cmake \ | |
| libopenblas-dev | |
| # |
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 rle_decode(self, mask_rle, shape=(768, 768)): | |
| ''' | |
| mask_rle: run-length as string formated (start length) | |
| shape: (height,width) of array to return | |
| Returns numpy array, 1 - mask, 0 - background | |
| ''' | |
| if not isinstance(mask_rle, str): | |
| img = np.zeros(shape[0]*shape[1], dtype=np.uint8) | |
| return img.reshape(shape).T |
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
| train_ship_segmentations_df = pd.read_csv(os.path.join("./datasets/train_val/train_ship_segmentations.csv")) | |
| msk = np.random.rand(len(train_ship_segmentations_df)) < 0.8 | |
| train = train_ship_segmentations_df[msk] | |
| test = train_ship_segmentations_df[~msk] | |
| # Move train set | |
| for index, row in train.iterrows(): | |
| image_id = row["ImageId"] |
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 build_network(self): | |
| # Create placeholders | |
| with tf.name_scope('inputs'): | |
| self.X = tf.placeholder(tf.float32, shape=(self.n_x, None), name="X") | |
| self.Y = tf.placeholder(tf.float32, shape=(self.n_y, None), name="Y") | |
| self.discounted_episode_rewards_norm = tf.placeholder(tf.float32, [None, ], name="actions_value") | |
| # Initialize parameters | |
| units_layer_1 = 10 | |
| units_layer_2 = 10 | |
| units_output_layer = self.n_y |
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 matplotlib | |
| import matplotlib.pyplot as plt | |
| import random | |
| class Individual(object): | |
| def __init__(self, numbers=None, mutate_prob=0.01): | |
| if numbers is None: | |
| self.numbers = np.random.randint(101, size=10) |
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 gym | |
| from gym import wrappers | |
| import random | |
| import numpy as np | |
| import tensorflow as tf | |
| import tflearn | |
| from tflearn.layers.core import input_data, dropout, fully_connected | |
| from tflearn.layers.estimator import regression | |
| from statistics import mean, median | |
| from collections import Counter |