Commit c0a81d51 authored by Yuxin Wu's avatar Yuxin Wu

docs update

parent 860efcf0
......@@ -64,7 +64,7 @@ See [tutorials](http://tensorpack.readthedocs.io/en/latest/tutorial/index.html)
Dependencies:
+ Python 2 or 3
+ Python 2.7 or 3
+ TensorFlow >= 1.0.0 (>=1.1.0 for Multi-GPU)
+ Python bindings for OpenCV (Optional, but required by a lot of features)
```
......
......@@ -78,7 +78,7 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
with tf.device('/cpu:0'):
for th in [0.5, 0.2, 0.1]:
valid_prediction = tf.cast(valid_label_prob > th, tf.int32)
prediction_corr = tf.count_nonzero(tf.equal(valid_prediction, valid_anchor_labels))
nr_pos_prediction = tf.count_nonzero(valid_prediction, name='num_pos_prediction')
pos_prediction_corr = tf.count_nonzero(tf.logical_and(
valid_label_prob > th,
tf.equal(valid_prediction, valid_anchor_labels)))
......@@ -86,8 +86,8 @@ def rpn_losses(anchor_labels, anchor_boxes, label_logits, box_logits):
pos_prediction_corr,
nr_pos, name='recall_th{}'.format(th)))
summaries.append(tf.truediv(
prediction_corr,
nr_valid, name='accuracy_th{}'.format(th)))
pos_prediction_corr,
nr_pos_prediction, name='precision_th{}'.format(th)))
label_loss = tf.nn.sigmoid_cross_entropy_with_logits(
labels=tf.to_float(valid_anchor_labels), logits=valid_label_logits)
......@@ -403,9 +403,6 @@ def fastrcnn_losses(labels, label_logits, fg_boxes, fg_box_logits):
label_loss = tf.nn.sparse_softmax_cross_entropy_with_logits(
labels=labels, logits=label_logits)
label_loss = tf.reduce_mean(label_loss, name='label_loss')
prediction = tf.argmax(label_logits, axis=1, name='label_prediction')
correct = tf.to_float(tf.equal(prediction, labels)) # boolean/integer gather is unavailable on GPU
accuracy = tf.reduce_mean(correct, name='accuracy')
fg_inds = tf.where(labels > 0)[:, 0]
fg_labels = tf.gather(labels, fg_inds)
......@@ -415,7 +412,10 @@ def fastrcnn_losses(labels, label_logits, fg_boxes, fg_box_logits):
tf.to_int32(fg_labels) - 1], axis=1) # #fgx2
fg_box_logits = tf.gather_nd(fg_box_logits, indices)
# some metrics to summarize
with tf.name_scope('label_metrics'), tf.device('/cpu:0'):
prediction = tf.argmax(label_logits, axis=1, name='label_prediction')
correct = tf.to_float(tf.equal(prediction, labels)) # boolean/integer gather is unavailable on GPU
accuracy = tf.reduce_mean(correct, name='accuracy')
fg_label_pred = tf.argmax(tf.gather(label_logits, fg_inds), axis=1)
num_zero = tf.reduce_sum(tf.to_int32(tf.equal(fg_label_pred, 0)), name='num_zero')
false_negative = tf.truediv(num_zero, num_fg, name='false_negative')
......
......@@ -17,6 +17,10 @@ import tensorflow as tf
"""
Usage:
Download caffe models at https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet
Install caffe python bindings.
python -m tensorpack.utils.loadcaffe PATH/TO/CAFFE/{deploy.prototxt,bvlc_alexnet.caffemodel} alexnet.npy
./load-alexnet.py --load alexnet.npy --input cat.png
"""
......
......@@ -17,6 +17,11 @@ from tensorpack.dataflow.dataset import ILSVRCMeta
"""
Usage:
Download original caffe models at:
https://gist.github.com/ksimonyan/211839e770f7b538e2d8
Install caffe python bindings.
python -m tensorpack.utils.loadcaffe \
PATH/TO/VGG/{VGG_ILSVRC_16_layers_deploy.prototxt,VGG_ILSVRC_16_layers.caffemodel} vgg16.npy
./load-vgg16.py --load vgg16.npy --input cat.png
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment