mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-21 05:53:24 -07:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
5e7a601c49
5 changed files with 23 additions and 8 deletions
|
@ -150,7 +150,7 @@ DeepFaceLab is used by such popular youtube channels as
|
|||
|
||||
<img src="doc/political_speech2.jpg" align="center">
|
||||
|
||||
 https://www.youtube.com/watch?v=sbFHhpYU15w
|
||||
 https://www.youtube.com/watch?v=IvY-Abd2FfM
|
||||
|
||||
<img src="doc/political_speech3.jpg" align="center">
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ class Devices(object):
|
|||
os.environ['NN_DEVICES_INITIALIZED'] = '1'
|
||||
os.environ['NN_DEVICES_COUNT'] = '0'
|
||||
|
||||
os.environ['CUDA_CACHE_MAXSIZE'] = '2147483647'
|
||||
min_cc = int(os.environ.get("TF_MIN_REQ_CAP", 35))
|
||||
libnames = ('libcuda.so', 'libcuda.dylib', 'nvcuda.dll')
|
||||
for libname in libnames:
|
||||
|
|
|
@ -70,7 +70,6 @@ class nn():
|
|||
first_run = True
|
||||
os.environ['CUDA_CACHE_PATH'] = str(compute_cache_path)
|
||||
|
||||
#nvcuda.dll ignores this param : os.environ['CUDA_CACHE_MAXSIZE'] = '536870912' #512Mb (32mb default)
|
||||
os.environ['TF_MIN_GPU_MULTIPROCESSOR_COUNT'] = '2'
|
||||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # tf log errors only
|
||||
|
||||
|
|
|
@ -342,10 +342,13 @@ def depth_to_space(x, size):
|
|||
x = tf.transpose(x, (0, 3, 4, 1, 5, 2))
|
||||
x = tf.reshape(x, (-1, oc, oh, ow))
|
||||
return x
|
||||
|
||||
|
||||
nn.depth_to_space = depth_to_space
|
||||
|
||||
def pixel_norm(x, power = 1.0):
|
||||
return x * power * tf.rsqrt(tf.reduce_mean(tf.square(x), axis=nn.conv2d_spatial_axes, keepdims=True) + 1e-06)
|
||||
nn.pixel_norm = pixel_norm
|
||||
|
||||
|
||||
def rgb_to_lab(srgb):
|
||||
srgb_pixels = tf.reshape(srgb, [-1, 3])
|
||||
linear_mask = tf.cast(srgb_pixels <= 0.04045, dtype=tf.float32)
|
||||
|
@ -376,6 +379,18 @@ def rgb_to_lab(srgb):
|
|||
return tf.reshape(lab_pixels, tf.shape(srgb))
|
||||
nn.rgb_to_lab = rgb_to_lab
|
||||
|
||||
def total_variation_mse(images):
|
||||
"""
|
||||
Same as generic total_variation, but MSE diff instead of MAE
|
||||
"""
|
||||
pixel_dif1 = images[:, 1:, :, :] - images[:, :-1, :, :]
|
||||
pixel_dif2 = images[:, :, 1:, :] - images[:, :, :-1, :]
|
||||
|
||||
tot_var = ( tf.reduce_sum(tf.square(pixel_dif1), axis=[1,2,3]) +
|
||||
tf.reduce_sum(tf.square(pixel_dif2), axis=[1,2,3]) )
|
||||
return tot_var
|
||||
nn.total_variation_mse = total_variation_mse
|
||||
|
||||
"""
|
||||
def tf_suppress_lower_mean(t, eps=0.00001):
|
||||
if t.shape.ndims != 1:
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 519 KiB After Width: | Height: | Size: 349 KiB |
Loading…
Add table
Add a link
Reference in a new issue