This file contains 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 each colored label map that GTAV provides, | |
create a grayscale label map for 20 classes with pixels values in [0, 19]. | |
''' | |
import os, os.path as op | |
import numpy as np | |
import cv2 | |
from glob import glob | |
from progressbar import ProgressBar |
This file contains 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 each gtFine_labelIds file of Cityscrapes dataset, | |
create a grayscale label map synthetic<->real task | |
with 20 classes with pixels values in [0, 19], | |
where #19 is the background. | |
The classes are compatible with github.com/mil-tokyo/MCD_DA. | |
''' | |
import os, os.path as op | |
import numpy as np |
This file contains 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
# Usage: | |
# watcher = UpdateWatcher(changing_file_path) | |
# while True: | |
# watcher.wait_for_update() | |
# # Do my stuff. | |
import os, os.path as op | |
import time | |
import logging |
This file contains 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
# imports and other stuff | |
# example constants and instances of classes | |
data = Data() # some data provider | |
model = Model() # some model | |
batch_size = 16 | |
pretrained_model_path = 'model/my_model' | |
log_dir = 'logs' |
This file contains 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
# Copyright 2015 Google Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains 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 math import sqrt | |
def put_kernels_on_grid (kernel, pad = 1): | |
'''Visualize conv. filters as an image (mostly for the 1st layer). | |
Arranges filters into a grid, with some paddings between adjacent filters. | |
Args: | |
kernel: tensor of shape [Y, X, NumChannels, NumKernels] | |
pad: number of black pixels around each filter (between them) |
This file contains 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
# !!! Note for cifar10_train_and_eval.py !!! | |
# | |
# 1. Put this file into tensorflow/models/image/cifar10 directory. | |
# 2. For this file to work, you need to comment out tf.image_summary() in | |
# file tensorflow/models/image/cifar_input.py | |
# | |
# Copyright 2015 Google Inc. All Rights Reserved. | |
# |