Skip to content

Instantly share code, notes, and snippets.

@Ruqyai
Ruqyai / MoonsTour
Last active October 20, 2018 06:44
How reset the default setting to play and stop a sound when detect a target image
/*==============================================================================
Copyright (c) 2017 PTC Inc. All Rights Reserved.
Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc.
All Rights Reserved.
Confidential and Proprietary - Protected under copyright and other laws.
==============================================================================*/
using UnityEngine;
using Vuforia;
@Ruqyai
Ruqyai / MoonsTour
Created October 20, 2018 06:48
How to rotate the earth
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateEarth : MonoBehaviour {
// Use this for initialization
void Start () {
}
def generate_estimator(output_dir):
return tf.estimator.DNNRegressor(feature_columns=feature_cols,
hidden_units=[10, 10],
model_dir=output_dir)
def generate_input_fn(data_set):
def input_fn():
features = {k: tf.constant(data_set[k].values) for k in FEATURES}
labels = tf.constant(data_set[LABEL].values)
return features, labels
return input_fn
def serving_input_fn():
#feature_placeholders are what the caller of the predict() method will have to provide
feature_placeholders = {
column.name: tf.placeholder(column.dtype, [None])
for column in feature_cols
}
#features are what we actually pass to the estimator
features = {
# Inputs are rank 1 so that we can provide scalars to the server
train_spec = tf.estimator.TrainSpec(
input_fn=generate_input_fn(data_train),
max_steps=3000)
exporter = tf.estimator.LatestExporter('Servo', serving_input_fn)
eval_spec=tf.estimator.EvalSpec(
input_fn=generate_input_fn(data_test),
steps=1,
exporters=exporter)
%%bash
mkdir trainer
touch trainer/__init__.py
%%writefile trainer/task.py
import argparse
import pandas as pd
import tensorflow as tf
from tensorflow.contrib.learn.python.learn import learn_runner
from tensorflow.contrib.learn.python.learn.utils import saved_model_export_utils
print(tf.__version__)
tf.logging.set_verbosity(tf.logging.ERROR)
GCS_BUCKET = 'gs://BUCKET_NAME' #غير هذه الى اسم البكت الخاصة بك CHANGE THIS TO YOUR BUCKET
PROJECT = 'PROJECT_ID' #غير هذا الى اسم المشروع الخاص بك CHANGE THIS TO YOUR PROJECT ID
REGION = 'us-central1' #اختياري ماهي المنطقة OPTIONALLY CHANGE THIS
%%bash
gcloud ai-platform local train \
--module-name=trainer.task \
--package-path=trainer \
-- \
--output_dir='./output'