Ejemplo n.º 1
0
from tvtk.api import tvtk, write_data

import sys
sys.path.append('../')

import model.flow_net as flow_net 
from inputs.flow_data_queue import Sailfish_data
from utils.experiment_manager import make_checkpoint_path
from utils.boundary_utils import get_random_params

import matplotlib.pyplot as plt

FLAGS = tf.app.flags.FLAGS

FLOW_DIR = make_checkpoint_path(FLAGS.base_dir_flow, FLAGS, network="flow")
BOUNDARY_DIR = make_checkpoint_path(FLAGS.base_dir_boundary_flow, FLAGS, network="boundary")
print(BOUNDARY_DIR)
print(FLOW_DIR)

shape = FLAGS.shape.split('x')
shape = map(int, shape)

def evaluate():
  """Run Eval once.
  """
  with tf.Session() as sess:
    # Make image placeholder
    param_inputs, _ = flow_net.inputs_boundary(FLAGS.nr_boundary_params, 1, shape)

    # Make boundary
Ejemplo n.º 2
0
FLAGS = tf.app.flags.FLAGS

tf.app.flags.DEFINE_string('base_dir', '../checkpoints',
                           """dir to store trained net """)
tf.app.flags.DEFINE_integer('batch_size', 8, """ training batch size """)
tf.app.flags.DEFINE_integer('max_steps', 500000,
                            """ max number of steps to train """)
tf.app.flags.DEFINE_float('keep_prob', 0.7,
                          """ keep probability for dropout """)
tf.app.flags.DEFINE_float('learning_rate', 1e-4,
                          """ keep probability for dropout """)
tf.app.flags.DEFINE_bool('display_test', True, """ display the test images """)
tf.app.flags.DEFINE_string('test_set', "car", """ either car or random """)

TEST_DIR = make_checkpoint_path(FLAGS.base_dir, FLAGS)


def tryint(s):
    try:
        return int(s)
    except:
        return s


def alphanum_key(s):
    return [tryint(c) for c in re.split('([0-9]+)', s)]


def evaluate():
    """Run Eval once.
import sys
sys.path.append('../')

import model.flow_net as flow_net
from inputs.flow_data_queue import Sailfish_data
from utils.experiment_manager import make_checkpoint_path
from model.pressure import calc_force
from model.velocity_norm import calc_velocity_norm

import matplotlib.pyplot as plt
from tqdm import *

FLAGS = tf.app.flags.FLAGS

FLOW_DIR = make_checkpoint_path(FLAGS.base_dir_flow, FLAGS, network="flow")

shape = FLAGS.shape.split('x')
shape = map(int, shape)

batch_size = 10


def tryint(s):
    try:
        return int(s)
    except:
        return s


def alphanum_key(s):
import matplotlib.pyplot as plt

#SMALL_SIZE = 12
#MEDIUM_SIZE = 16
#BIGGER_SIZE = 18

#plt.rc('font', size=MEDIUM_SIZE)          # controls default text sizes
#plt.rc('axes', titlesize=MEDIUM_SIZE)    # fontsize of the axes title
#plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
#plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize
#plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title

FLAGS = tf.app.flags.FLAGS

FLOW_DIR = make_checkpoint_path(FLAGS.base_dir_heat, FLAGS, network="heat")
BOUNDARY_DIR = make_checkpoint_path(FLAGS.base_dir_boundary_heat,
                                    FLAGS,
                                    network="boundary")
print(FLOW_DIR)
print(BOUNDARY_DIR)

shape = FLAGS.shape.split('x')
shape = map(int, shape)
batch_size = 1


def evaluate():
    """Run Eval once.

  Args:
Ejemplo n.º 5
0
import numpy as np
import tensorflow as tf

import sys
sys.path.append('../')
import model.flow_net as flow_net
from inputs.vtk_data import VTK_data
from inputs.boundary_data_queue import Boundary_data
from utils.experiment_manager import make_checkpoint_path

import matplotlib.pyplot as plt

FLAGS = tf.app.flags.FLAGS

TRAIN_DIR = make_checkpoint_path(FLAGS.base_dir_boundary_flow,
                                 FLAGS,
                                 network="boundary")

shape = FLAGS.dims * [FLAGS.obj_size]


def train():
    """Train ring_net for a number of steps."""
    with tf.Graph().as_default():
        # global step counter
        global_step = tf.get_variable('global_step', [],
                                      initializer=tf.constant_initializer(0),
                                      trainable=False)

        # make inputs
        input_dims = FLAGS.nr_boundary_params
Ejemplo n.º 6
0
import numpy as np
import tensorflow as tf

import sys
sys.path.append('../')

import model.flow_net as flow_net
from inputs.vtk_data import VTK_data
from utils.experiment_manager import make_checkpoint_path

import matplotlib.pyplot as plt

FLAGS = tf.app.flags.FLAGS

BOUNDARY_DIR = make_checkpoint_path(FLAGS.base_dir_boundary,
                                    FLAGS,
                                    network="boundary")

# video init
shape = FLAGS.shape.split('x')
shape = map(int, shape)
batch_size = 1


def tryint(s):
    try:
        return int(s)
    except:
        return s

Ejemplo n.º 7
0
import tensorflow as tf

import sys
sys.path.append('../')

import model.flow_net as flow_net
from inputs.heat_data_queue import Heat_Sink_data
from utils.experiment_manager import make_checkpoint_path
from model.optimizer import *

from tqdm import *
import matplotlib.pyplot as plt

FLAGS = tf.app.flags.FLAGS

TRAIN_DIR = make_checkpoint_path(FLAGS.base_dir_heat, FLAGS, network="heat")

shape = FLAGS.shape.split('x')
shape = map(int, shape)

def train():
  """Train ring_net for a number of steps."""
  with tf.Graph().as_default():

    # store grad and loss values
    grads = []
    loss_gen = []
    
    # global step counter
    global_step = tf.get_variable('global_step', [], initializer=tf.constant_initializer(0), trainable=False)