Skip to content

Commit

Permalink
set TF verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoopes committed Apr 9, 2021
1 parent 3144cbc commit a5d42bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import nibabel as nib
import freesurfer as fs
from copy import deepcopy
from scipy.ndimage import label, binary_dilation, distance_transform_edt

# set tensorflow logging
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

import tensorflow as tf
from tensorflow import keras

# set tensorflow logging
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)


Expand Down
3 changes: 2 additions & 1 deletion mri_synth_strip/mri_synth_strip
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ parser.add_argument('-v', '--verbose', action='store_true', help='Verbose output
parser.add_argument('-g', '--gpu', help='GPU ID. CPU is used by default.')
args = parser.parse_args()

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '0' if args.verbose else '3'

# defer slow tensorflow imports for faster argument parsing
import neurite as ne
import tensorflow as tf

# set verbosity
if not args.verbose:
warnings.filterwarnings('ignore')
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)

# load input volume
Expand Down

0 comments on commit a5d42bf

Please sign in to comment.