小编use*_*047的帖子

测试时Tensorflow batch_norm无法正常工作(is_training = False)

我正在训练以下模型:

with slim.arg_scope(inception_arg_scope(is_training=True)):
    logits_v, endpoints_v = inception_v3(all_v, num_classes=25, is_training=True, dropout_keep_prob=0.8,
                     spatial_squeeze=True, reuse=reuse_variables, scope='vis')
    logits_p, endpoints_p = inception_v3(all_p, num_classes=25, is_training=True, dropout_keep_prob=0.8,
                     spatial_squeeze=True, reuse=reuse_variables, scope='pol')
    pol_features = endpoints_p['pol/features']
    vis_features = endpoints_v['vis/features']

eps = 1e-08
loss = tf.sqrt(tf.maximum(tf.reduce_sum(tf.square(pol_features - vis_features), axis=1, keep_dims=True), eps))

# rest of code
saver = tf.train.Saver(tf.global_variables())
Run Code Online (Sandbox Code Playgroud)

哪里

def inception_arg_scope(weight_decay=0.00004,
                    batch_norm_decay=0.9997,
                    batch_norm_epsilon=0.001, is_training=True):
normalizer_params = {
    'decay': batch_norm_decay,
    'epsilon': batch_norm_epsilon,
    'is_training': is_training
}
normalizer_fn = tf.contrib.layers.batch_norm

# Set weight_decay for weights in Conv and FC layers.
with slim.arg_scope([slim.conv2d, slim.fully_connected],
                    weights_regularizer=slim.l2_regularizer(weight_decay)): …
Run Code Online (Sandbox Code Playgroud)

testing tensorflow batch-normalization

7
推荐指数
1
解决办法
4093
查看次数

在Android中同时使用Datagramsocket发送和接收-仅发送?

我在一个线程中使用DatagramSocket来接收数据,在另一个线程中使用DatagramSocket将数据发送到PC(Java)。但它仅每1秒发送一次数据,但不会接收。但是当我在发送代码后将接收代码放在同一线程中时...它可以工作...但是我想每秒发送一次数据并同时等待任何数据...

编辑:我发现问题是我无法在两个不同的线程中打开端口。现在我的问题是,如何才能DatagramSocket.Receive()每1秒取消一次并发送数据,然后又返回接收呢?

public class MainActivity extends ActionBarActivity {

TextView status;
GPSTracker gps;
boolean started = false;
boolean waitting = false;
String mess = "Waiting ...";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    status = (TextView) findViewById(R.id.status);

    gps = new GPSTracker(MainActivity.this);

    Timer time = new Timer(); // Instantiate Timer Object
    ScheduledTask st = new ScheduledTask(); 
    time.schedule(st, 0, 1000); // Create Repetitively task for every 1 secs
}

public class SendThread implements Runnable {
    private DatagramSocket mySocket;

    public void …
Run Code Online (Sandbox Code Playgroud)

java android datagram send

4
推荐指数
1
解决办法
4510
查看次数