Skip to content

Instantly share code, notes, and snippets.

{
"FileVersion": 3,
"EngineAssociation": "4.10",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "Asteroids",
"Type": "Runtime",
"LoadingPhase": "Default",
protected boolean isAvailable() {
if (getActivity() == null) return false;
if (getActivity().isFinishing()) return false;
if (!isAdded()) return false;
if (isDetached()) return false;
if (!isVisible()) return false;
return true;
}
std::string shaderCode = "";
std::ifstream codeStream(shaderPath, std::ios::in);
if (codeStream.is_open())
{
std::string line = "";
while (getline(codeStream, line))
shaderCode += "\n" + line;
codeStream.close();
}
# based on https://medium.com/initialized-capital/we-need-to-go-deeper-a-practical-guide-to-tensorflow-and-inception-50e66281804f
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('data/mnist', one_hot=True)
from tensorflow.contrib.slim.nets import inception as nn_architecture
from tensorflow.contrib import slim
from skimage import io
def extract_annotations(path):
image = io.imread("data/cowc/datasets/ground_truth_sets/Toronto_ISPRS/03559_Annotated_Cars.png")
print('%d, %d' % (image.shape[0], image.shape[1]))
i = 1;
for x in range(0, image.shape[0]):
for y in range(0, image.shape[1]):
if image[x][y][0] > 0:
all my code related to loss:
loss = tf.losses.softmax_cross_entropy(onehot_labels=labels, logits=logits)
total_loss = tf.losses.get_total_loss()
...
train_step = slim.learning.create_train_op(total_loss, optimizer, variables_to_train=variables_to_train) #better than Optimizer.minimize because it prevents problems like vanishing gradient
...
#this is writing everything to tensorboard
tf.summary.scalar('total loss', total_loss)