Open rubbyaworka opened 3 years ago
python from __future__ import division, print_function %matplotlib inline import matplotlib.pyplot as plt import matplotlib import numpy as np plt.rcParams['image.cmap'] = 'gist_earth' np.random.seed(98765) `python from tf_unet import image_gen from tf_unet import unet from tf_unet import util
python from __future__ import division, print_function %matplotlib inline import matplotlib.pyplot as plt import matplotlib import numpy as np plt.rcParams['image.cmap'] = 'gist_earth' np.random.seed(98765)
nx = 572 ny = 572
generator = image_gen.GrayScaleDataProvider(nx, ny, cnt=20)
x_test, y_test = generator(1)
fig, ax = plt.subplots(1,2, sharey=True, figsize=(8,4)) ax[0].imshow(x_test[0,...,0], aspect="auto") ax[1].imshow(y_test[0,...,1], aspect="auto")
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
net = unet.Unet(channels=generator.channels, n_class=generator.n_class, layers=3, features_root=16)
trainer = unet.Trainer(net, optimizer="momentum", opt_kwargs=dict(momentum=0.2))
path = trainer.train(generator, "./unet_trained", training_iters=32, epochs=10, display_step=2) `
the error of the path
TypeError Traceback (most recent call last)
Hi @rubbyaworka this code hasn't been maintained for quite a while. There is a Tensorflow 2.0 compatible reimplementation of tf_unet available here: https://github.com/jakeret/unet
tf_unet
python from __future__ import division, print_function %matplotlib inline import matplotlib.pyplot as plt import matplotlib import numpy as np plt.rcParams['image.cmap'] = 'gist_earth' np.random.seed(98765)
`python from tf_unet import image_gen from tf_unet import unet from tf_unet import utilnx = 572 ny = 572
generator = image_gen.GrayScaleDataProvider(nx, ny, cnt=20)
x_test, y_test = generator(1)
fig, ax = plt.subplots(1,2, sharey=True, figsize=(8,4)) ax[0].imshow(x_test[0,...,0], aspect="auto") ax[1].imshow(y_test[0,...,1], aspect="auto")
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
net = unet.Unet(channels=generator.channels, n_class=generator.n_class, layers=3, features_root=16)
trainer = unet.Trainer(net, optimizer="momentum", opt_kwargs=dict(momentum=0.2))
path = trainer.train(generator, "./unet_trained", training_iters=32, epochs=10, display_step=2) `
the error of the path
TypeError Traceback (most recent call last)