mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 13:02:15 -07:00
forcing all tqdm's to ascii in order to work properly on Chinese windows
This commit is contained in:
parent
1e7a0836f7
commit
72646becd1
5 changed files with 24 additions and 25 deletions
|
@ -259,7 +259,7 @@ def main (input_dir, output_dir, model_dir, model_name, aligned_dir=None, **in_o
|
|||
alignments = {}
|
||||
|
||||
aligned_path_image_paths = Path_utils.get_image_paths(aligned_path)
|
||||
for filename in tqdm(aligned_path_image_paths, desc= "Collecting alignments" ):
|
||||
for filename in tqdm(aligned_path_image_paths, desc="Collecting alignments", ascii=True ):
|
||||
dflpng = DFLPNG.load( str(filename), print_on_no_embedded_data=True )
|
||||
if dflpng is None:
|
||||
continue
|
||||
|
|
|
@ -3,7 +3,6 @@ import os
|
|||
import sys
|
||||
import time
|
||||
import multiprocessing
|
||||
from tqdm import tqdm
|
||||
from pathlib import Path
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
|
|
@ -131,14 +131,14 @@ def sort_by_blur(input_path):
|
|||
|
||||
def sort_by_brightness(input_path):
|
||||
print ("Sorting by brightness...")
|
||||
img_list = [ [x, np.mean ( cv2.cvtColor(cv2.imread(x), cv2.COLOR_BGR2HSV)[...,2].flatten() )] for x in tqdm( Path_utils.get_image_paths(input_path), desc="Loading") ]
|
||||
img_list = [ [x, np.mean ( cv2.cvtColor(cv2.imread(x), cv2.COLOR_BGR2HSV)[...,2].flatten() )] for x in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True) ]
|
||||
print ("Sorting...")
|
||||
img_list = sorted(img_list, key=operator.itemgetter(1), reverse=True)
|
||||
return img_list
|
||||
|
||||
def sort_by_hue(input_path):
|
||||
print ("Sorting by hue...")
|
||||
img_list = [ [x, np.mean ( cv2.cvtColor(cv2.imread(x), cv2.COLOR_BGR2HSV)[...,0].flatten() )] for x in tqdm( Path_utils.get_image_paths(input_path), desc="Loading") ]
|
||||
img_list = [ [x, np.mean ( cv2.cvtColor(cv2.imread(x), cv2.COLOR_BGR2HSV)[...,0].flatten() )] for x in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True) ]
|
||||
print ("Sorting...")
|
||||
img_list = sorted(img_list, key=operator.itemgetter(1), reverse=True)
|
||||
return img_list
|
||||
|
@ -148,7 +148,7 @@ def sort_by_face(input_path):
|
|||
print ("Sorting by face similarity...")
|
||||
|
||||
img_list = []
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading"):
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True):
|
||||
filepath = Path(filepath)
|
||||
|
||||
if filepath.suffix != '.png':
|
||||
|
@ -163,7 +163,7 @@ def sort_by_face(input_path):
|
|||
|
||||
|
||||
img_list_len = len(img_list)
|
||||
for i in tqdm ( range(0, img_list_len-1), desc="Sorting"):
|
||||
for i in tqdm ( range(0, img_list_len-1), desc="Sorting", ascii=True):
|
||||
min_score = float("inf")
|
||||
j_min_score = i+1
|
||||
for j in range(i+1,len(img_list)):
|
||||
|
@ -184,7 +184,7 @@ def sort_by_face_dissim(input_path):
|
|||
print ("Sorting by face dissimilarity...")
|
||||
|
||||
img_list = []
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading"):
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True):
|
||||
filepath = Path(filepath)
|
||||
|
||||
if filepath.suffix != '.png':
|
||||
|
@ -198,7 +198,7 @@ def sort_by_face_dissim(input_path):
|
|||
img_list.append( [str(filepath), dflpng.get_landmarks(), 0 ] )
|
||||
|
||||
img_list_len = len(img_list)
|
||||
for i in tqdm( range(0, img_list_len-1), desc="Sorting"):
|
||||
for i in tqdm( range(0, img_list_len-1), desc="Sorting", ascii=True):
|
||||
score_total = 0
|
||||
for j in range(i+1,len(img_list)):
|
||||
if i == j:
|
||||
|
@ -217,7 +217,7 @@ def sort_by_face_dissim(input_path):
|
|||
def sort_by_face_yaw(input_path):
|
||||
print ("Sorting by face yaw...")
|
||||
img_list = []
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading"):
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True):
|
||||
filepath = Path(filepath)
|
||||
|
||||
if filepath.suffix != '.png':
|
||||
|
@ -436,7 +436,7 @@ def sort_by_hist_dissim(input_path):
|
|||
print ("Sorting by histogram dissimilarity...")
|
||||
|
||||
img_list = []
|
||||
for filename_path in tqdm( Path_utils.get_image_paths(input_path), desc="Loading"):
|
||||
for filename_path in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True):
|
||||
image = cv2.imread(filename_path)
|
||||
|
||||
dflpng = DFLPNG.load( str(filename_path) )
|
||||
|
@ -563,7 +563,7 @@ def sort_final(input_path):
|
|||
grads_space = np.linspace (-255,255,grads)
|
||||
|
||||
yaws_sample_list = [None]*grads
|
||||
for g in tqdm ( range(grads), desc="Sort by yaw" ):
|
||||
for g in tqdm ( range(grads), desc="Sort by yaw", ascii=True ):
|
||||
yaw = grads_space[g]
|
||||
next_yaw = grads_space[g+1] if g < grads-1 else yaw
|
||||
|
||||
|
@ -578,7 +578,7 @@ def sort_final(input_path):
|
|||
yaws_sample_list[g] = yaw_samples
|
||||
|
||||
total_lack = 0
|
||||
for g in tqdm ( range (grads), desc="" ):
|
||||
for g in tqdm ( range (grads), desc="", ascii=True ):
|
||||
img_list = yaws_sample_list[g]
|
||||
img_list_len = len(img_list) if img_list is not None else 0
|
||||
|
||||
|
@ -588,7 +588,7 @@ def sort_final(input_path):
|
|||
imgs_per_grad += total_lack // grads
|
||||
sharpned_imgs_per_grad = imgs_per_grad*10
|
||||
|
||||
for g in tqdm ( range (grads), desc="Sort by blur" ):
|
||||
for g in tqdm ( range (grads), desc="Sort by blur", ascii=True ):
|
||||
img_list = yaws_sample_list[g]
|
||||
if img_list is None:
|
||||
continue
|
||||
|
@ -605,7 +605,7 @@ def sort_final(input_path):
|
|||
|
||||
yaws_sample_list[g] = img_list
|
||||
|
||||
for g in tqdm ( range (grads), desc="Sort by hist" ):
|
||||
for g in tqdm ( range (grads), desc="Sort by hist", ascii=True ):
|
||||
img_list = yaws_sample_list[g]
|
||||
if img_list is None:
|
||||
continue
|
||||
|
@ -620,7 +620,7 @@ def sort_final(input_path):
|
|||
|
||||
yaws_sample_list[g] = sorted(img_list, key=operator.itemgetter(3), reverse=True)
|
||||
|
||||
for g in tqdm ( range (grads), desc="Fetching best" ):
|
||||
for g in tqdm ( range (grads), desc="Fetching best", ascii=True ):
|
||||
img_list = yaws_sample_list[g]
|
||||
if img_list is None:
|
||||
continue
|
||||
|
@ -634,7 +634,7 @@ def sort_by_black(input_path):
|
|||
print ("Sorting by amount of black pixels...")
|
||||
|
||||
img_list = []
|
||||
for x in tqdm( Path_utils.get_image_paths(input_path), desc="Loading"):
|
||||
for x in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True):
|
||||
img = cv2.imread(x)
|
||||
img_list.append ([x, img[(img == 0)].size ])
|
||||
|
||||
|
@ -654,7 +654,7 @@ def final_process(input_path, img_list, trash_img_list):
|
|||
for filename in Path_utils.get_image_paths(trash_path):
|
||||
Path(filename).unlink()
|
||||
|
||||
for i in tqdm( range(len(trash_img_list)), desc="Moving trash" , leave=False):
|
||||
for i in tqdm( range(len(trash_img_list)), desc="Moving trash" , leave=False, ascii=True):
|
||||
src = Path (trash_img_list[i][0])
|
||||
dst = trash_path / src.name
|
||||
try:
|
||||
|
@ -664,7 +664,7 @@ def final_process(input_path, img_list, trash_img_list):
|
|||
|
||||
print ("")
|
||||
|
||||
for i in tqdm( range(len(img_list)), desc="Renaming" , leave=False):
|
||||
for i in tqdm( range(len(img_list)), desc="Renaming" , leave=False, ascii=True):
|
||||
src = Path (img_list[i][0])
|
||||
dst = input_path / ('%.5d_%s' % (i, src.name ))
|
||||
try:
|
||||
|
@ -672,7 +672,7 @@ def final_process(input_path, img_list, trash_img_list):
|
|||
except:
|
||||
print ('fail to rename %s' % (src.name) )
|
||||
|
||||
for i in tqdm( range(len(img_list)) , desc="Renaming" ):
|
||||
for i in tqdm( range(len(img_list)) , desc="Renaming", ascii=True ):
|
||||
src = Path (img_list[i][0])
|
||||
|
||||
src = input_path / ('%.5d_%s' % (i, src.name))
|
||||
|
@ -686,7 +686,7 @@ def sort_by_origname(input_path):
|
|||
print ("Sort by original filename...")
|
||||
|
||||
img_list = []
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading"):
|
||||
for filepath in tqdm( Path_utils.get_image_paths(input_path), desc="Loading", ascii=True):
|
||||
filepath = Path(filepath)
|
||||
|
||||
if filepath.suffix != '.png':
|
||||
|
|
|
@ -27,7 +27,7 @@ class SampleLoader:
|
|||
|
||||
if sample_type == SampleType.IMAGE:
|
||||
if datas[sample_type] is None:
|
||||
datas[sample_type] = [ Sample(filename=filename) for filename in tqdm( Path_utils.get_image_paths(samples_path), desc="Loading" ) ]
|
||||
datas[sample_type] = [ Sample(filename=filename) for filename in tqdm( Path_utils.get_image_paths(samples_path), desc="Loading", ascii=True ) ]
|
||||
|
||||
elif sample_type == SampleType.FACE:
|
||||
if datas[sample_type] is None:
|
||||
|
@ -53,7 +53,7 @@ class SampleLoader:
|
|||
def upgradeToFaceSamples ( samples ):
|
||||
sample_list = []
|
||||
|
||||
for s in tqdm( samples, desc="Loading" ):
|
||||
for s in tqdm( samples, desc="Loading", ascii=True ):
|
||||
|
||||
s_filename_path = Path(s.filename)
|
||||
if s_filename_path.suffix != '.png':
|
||||
|
@ -78,7 +78,7 @@ class SampleLoader:
|
|||
yaw_samples_len = len(yaw_samples)
|
||||
|
||||
sample_list = []
|
||||
for i in tqdm( range(yaw_samples_len), desc="Sorting" ):
|
||||
for i in tqdm( range(yaw_samples_len), desc="Sorting", ascii=True ):
|
||||
if yaw_samples[i] is not None:
|
||||
for s in yaw_samples[i]:
|
||||
s_t = []
|
||||
|
@ -114,7 +114,7 @@ class SampleLoader:
|
|||
|
||||
yaws_sample_list = [None]*gradations
|
||||
|
||||
for i in tqdm( range(0, gradations), desc="Sorting" ):
|
||||
for i in tqdm( range(0, gradations), desc="Sorting", ascii=True ):
|
||||
yaw = lowest_yaw + i*diff_rot_per_grad
|
||||
next_yaw = lowest_yaw + (i+1)*diff_rot_per_grad
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class SubprocessorBase(object):
|
|||
print ( self.get_no_process_started_message() )
|
||||
return None
|
||||
|
||||
self.progress_bar = tqdm( total=self.onHostGetProgressBarLen(), desc=self.onHostGetProgressBarDesc() )
|
||||
self.progress_bar = tqdm( total=self.onHostGetProgressBarLen(), desc=self.onHostGetProgressBarDesc(), ascii=True )
|
||||
self.onHostClientsInitialized()
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue