Skip to content

Instantly share code, notes, and snippets.

@eranheres
Created December 28, 2017 15:38
Show Gist options
  • Save eranheres/5aa93df3eaae32c33b05d2d85befb90d to your computer and use it in GitHub Desktop.
Save eranheres/5aa93df3eaae32c33b05d2d85befb90d to your computer and use it in GitHub Desktop.
--- object_detection/samples/cloud/cloud.yml 2017-12-28 16:49:11.000000000 +0200
+++ object_detection/samples/cloud/cloud.yml 2017-12-28 16:49:27.000000000 +0200
@@ -1,5 +1,5 @@
trainingInput:
- runtimeVersion: "1.0"
+ runtimeVersion: "1.4"
scaleTier: CUSTOM
masterType: standard_gpu
workerCount: 5
--- object_detection/evaluator.py 2017-12-28 16:30:11.000000000 +0200
+++ object_detection/evaluator.py 2017-12-28 16:33:13.000000000 +0200
@@ -181,7 +181,7 @@
return result_dict
variables_to_restore = tf.global_variables()
- global_step = tf.train.get_or_create_global_step()
+ global_step = tf.contrib.framework.get_or_create_global_step()
variables_to_restore.append(global_step)
if eval_config.use_moving_averages:
variable_averages = tf.train.ExponentialMovingAverage(0.0)
--- object_detection/builders/optimizer_builder.py 2017-12-28 16:35:02.000000000 +0200
+++ object_detection/builders/optimizer_builder.py 2017-12-28 16:35:55.000000000 +0200
@@ -100,7 +100,8 @@
learning_rate_sequence = [config.initial_learning_rate]
learning_rate_sequence += [x.learning_rate for x in config.schedule]
learning_rate = learning_schedules.manual_stepping(
- tf.train.get_or_create_global_step(), learning_rate_step_boundaries,
+ tf.contrib.framework.get_or_create_global_step(),
+ learning_rate_step_boundaries,
learning_rate_sequence)
if learning_rate_type == 'cosine_decay_learning_rate':
--- setup.py 2017-12-28 16:46:54.000000000 +0200
+++ setup_new.py 2017-12-28 16:46:06.000000000 +0200
@@ -1,10 +1,32 @@
"""Setup script for object_detection."""
+import logging
+import subprocess
from setuptools import find_packages
from setuptools import setup
+from setuptools.command.install import install
+class CustomCommands(install):
-REQUIRED_PACKAGES = ['Pillow>=1.0']
+ def RunCustomCommand(self, command_list):
+ p = subprocess.Popen(
+ command_list,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ stdout_data, _ = p.communicate()
+ logging.info('Log command output: %s', stdout_data)
+ if p.returncode != 0:
+ raise RuntimeError('Command %s failed: exit code: %s' %
+ (command_list, p.returncode))
+
+ def run(self):
+ self.RunCustomCommand(['apt-get', 'update'])
+ self.RunCustomCommand(
+ ['apt-get', 'install', '-y', 'python-tk'])
+ install.run(self)
+
+REQUIRED_PACKAGES = ['Pillow>=1.0', 'protobuf>=3.3.0', 'Matplotlib>=2.1']
setup(
name='object_detection',
@@ -13,4 +35,7 @@
include_package_data=True,
packages=[p for p in find_packages() if p.startswith('object_detection')],
description='Tensorflow Object Detection Library',
+ cmdclass={
+ 'install': CustomCommands,
+ }
)
--- object_detection/utils/visualization_utils.py 2017-12-28 16:23:30.000000000 +0200
+++ object_detection/utils/visualization_utils.py 2017-12-28 16:24:16.000000000 +0200
@@ -21,6 +21,8 @@
"""
import collections
import functools
+import matplotlib
+matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import PIL.Image as Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment