forked from NifTK/NiftyNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix_densevnet' into 'dev'
Fix densevnet See merge request CMIC/NiftyNet!200
- Loading branch information
Showing
2 changed files
with
130 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from __future__ import absolute_import, print_function | ||
|
||
import unittest | ||
|
||
import os | ||
import tensorflow as tf | ||
from tensorflow.contrib.layers.python.layers import regularizers | ||
|
||
from niftynet.network.dense_vnet import DenseVNet | ||
|
||
@unittest.skipIf(os.environ.get('QUICKTEST', "").lower() == "true", 'Skipping slow tests') | ||
class DenseVNetTest(tf.test.TestCase): | ||
def test_3d_shape(self): | ||
input_shape = (2, 72, 72, 72, 3) | ||
x = tf.ones(input_shape) | ||
|
||
dense_vnet_instance = DenseVNet( | ||
num_classes=2) | ||
out = dense_vnet_instance(x, is_training=True) | ||
# print(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)) | ||
|
||
with self.test_session() as sess: | ||
sess.run(tf.global_variables_initializer()) | ||
out = sess.run(out) | ||
self.assertAllClose((2, 72, 72, 72, 2), out.shape) | ||
|
||
def test_2d_shape(self): | ||
input_shape = (2, 72, 72, 3) | ||
x = tf.ones(input_shape) | ||
|
||
dense_vnet_instance = DenseVNet( | ||
num_classes=2) | ||
out = dense_vnet_instance(x, is_training=True) | ||
# print(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)) | ||
|
||
with self.test_session() as sess: | ||
sess.run(tf.global_variables_initializer()) | ||
out = sess.run(out) | ||
self.assertAllClose((2, 72, 72, 2), out.shape) | ||
|
||
if __name__ == "__main__": | ||
tf.test.main() |