Commit graph

81 commits

Author SHA1 Message Date
Colombo
935d940ace fix 2020-04-07 22:06:32 +04:00
Colombo
f821ab350f fix 2020-04-06 19:06:37 +04:00
Colombo
afdb1ef85d fix for 16+ CPU 2020-04-06 18:42:38 +04:00
Colombo
33b0aadb4e Decreased amount of RAM used by Sample Generator. 2020-04-05 13:52:32 +04:00
Colombo
2fe86faf01 fix Win10 input dialog 2020-04-02 10:27:39 +04:00
Colombo
6d3607a13d New script:
5.XSeg) data_dst/src mask for XSeg trainer - fetch.bat
Copies faces containing XSeg polygons to aligned_xseg\ dir.
Useful only if you want to collect labeled faces and reuse them in other fakes.

Now you can use trained XSeg mask in the SAEHD training process.
It’s mean default ‘full_face’ mask obtained from landmarks will be replaced with the mask obtained from the trained XSeg model.
use
5.XSeg.optional) trained mask for data_dst/data_src - apply.bat
5.XSeg.optional) trained mask for data_dst/data_src - remove.bat

Normally you don’t need it. You can use it, if you want to use ‘face_style’ and ‘bg_style’ with obstructions.

XSeg trainer : now you can choose type of face
XSeg trainer : now you can restart training in “override settings”
Merger: XSeg-* modes now can be used with all types of faces.

Therefore old MaskEditor, FANSEG models, and FAN-x modes have been removed,
because the new XSeg solution is better, simpler and more convenient, which costs only 1 hour of manual masking for regular deepfake.
2020-03-30 14:00:40 +04:00
Colombo
d1a5639e90 XSegEditor: fix bugs 2020-03-27 19:08:01 +04:00
Colombo
ca9138d6b7 XSegEditor: changed layout, added current filename 2020-03-27 00:11:36 +04:00
Colombo
8ad2a5373e fix Exception("nn devices are not initialized. Run initialize_main_env() in main process.") 2020-03-24 22:06:10 +04:00
Colombo
01d81674fd added new XSegEditor !
here new whole_face + XSeg workflow:

with XSeg model you can train your own mask segmentator for dst(and/or src) faces
that will be used by the merger for whole_face.

Instead of using a pretrained segmentator model (which does not exist),
you control which part of faces should be masked.

new scripts:
	5.XSeg) data_dst edit masks.bat
	5.XSeg) data_src edit masks.bat
	5.XSeg) train.bat

Usage:
	unpack dst faceset if packed

	run 5.XSeg) data_dst edit masks.bat

	Read tooltips on the buttons (en/ru/zn languages are supported)

	mask the face using include or exclude polygon mode.

	repeat for 50/100 faces,
		!!! you don't need to mask every frame of dst
		only frames where the face is different significantly,
		for example:
			closed eyes
			changed head direction
			changed light
		the more various faces you mask, the more quality you will get

		Start masking from the upper left area and follow the clockwise direction.
		Keep the same logic of masking for all frames, for example:
			the same approximated jaw line of the side faces, where the jaw is not visible
			the same hair line
		Mask the obstructions using exclude polygon mode.

	run XSeg) train.bat
		train the model

		Check the faces of 'XSeg dst faces' preview.

		if some faces have wrong or glitchy mask, then repeat steps:
			run edit
			find these glitchy faces and mask them
			train further or restart training from scratch

Restart training of XSeg model is only possible by deleting all 'model\XSeg_*' files.

If you want to get the mask of the predicted face (XSeg-prd mode) in merger,
you should repeat the same steps for src faceset.

New mask modes available in merger for whole_face:

XSeg-prd	  - XSeg mask of predicted face	-> faces from src faceset should be labeled
XSeg-dst	  - XSeg mask of dst face        	-> faces from dst faceset should be labeled
XSeg-prd*XSeg-dst - the smallest area of both

if workspace\model folder contains trained XSeg model, then merger will use it,
otherwise you will get transparent mask by using XSeg-* modes.

Some screenshots:
XSegEditor: https://i.imgur.com/7Bk4RRV.jpg
trainer   : https://i.imgur.com/NM1Kn3s.jpg
merger    : https://i.imgur.com/glUzFQ8.jpg

example of the fake using 13 segmented dst faces
          : https://i.imgur.com/wmvyizU.gifv
2020-03-24 12:15:31 +04:00
Colombo
eddebedcf6 SAEHD: added 'dfuhd' and 'liaeuhd' archi 2020-03-23 22:01:44 +04:00
Colombo
a9b23e9851 _ 2020-03-21 00:01:53 +04:00
Colombo
3fa93da5e7 upd 2020-03-20 11:37:42 +04:00
Colombo
4c24f9d41c _ 2020-03-19 13:29:33 +04:00
Colombo
f3b4658810 fixes 2020-03-16 22:40:55 +04:00
Colombo
45582d129d added XSeg model.
with XSeg model you can train your own mask segmentator of dst(and src) faces
that will be used in merger for whole_face.

Instead of using a pretrained model (which does not exist),
you control which part of faces should be masked.

Workflow is not easy, but at the moment it is the best solution
for obtaining the best quality of whole_face's deepfakes using minimum effort
without rotoscoping in AfterEffects.

new scripts:
	XSeg) data_dst edit.bat
	XSeg) data_dst merge.bat
	XSeg) data_dst split.bat
	XSeg) data_src edit.bat
	XSeg) data_src merge.bat
	XSeg) data_src split.bat
	XSeg) train.bat

Usage:
	unpack dst faceset if packed

	run XSeg) data_dst split.bat
		this scripts extracts (previously saved) .json data from jpg faces to use in label tool.

	run XSeg) data_dst edit.bat
		new tool 'labelme' is used

		use polygon (CTRL-N) to mask the face
			name polygon "1" (one symbol) as include polygon
			name polygon "0" (one symbol) as exclude polygon

			'exclude polygons' will be applied after all 'include polygons'

		Hot keys:
		ctrl-N			create polygon
		ctrl-J			edit polygon
		A/D 			navigate between frames
		ctrl + mousewheel 	image zoom
		mousewheel		vertical scroll
		alt+mousewheel		horizontal scroll

		repeat for 10/50/100 faces,
			you don't need to mask every frame of dst,
			only frames where the face is different significantly,
			for example:
				closed eyes
				changed head direction
				changed light
			the more various faces you mask, the more quality you will get

			Start masking from the upper left area and follow the clockwise direction.
			Keep the same logic of masking for all frames, for example:
				the same approximated jaw line of the side faces, where the jaw is not visible
				the same hair line
			Mask the obstructions using polygon with name "0".

	run XSeg) data_dst merge.bat
		this script merges .json data of polygons into jpg faces,
		therefore faceset can be sorted or packed as usual.

	run XSeg) train.bat
		train the model

		Check the faces of 'XSeg dst faces' preview.

		if some faces have wrong or glitchy mask, then repeat steps:
			split
			run edit
			find these glitchy faces and mask them
			merge
			train further or restart training from scratch

Restart training of XSeg model is only possible by deleting all 'model\XSeg_*' files.

If you want to get the mask of the predicted face in merger,
you should repeat the same steps for src faceset.

New mask modes available in merger for whole_face:

XSeg-prd	  - XSeg mask of predicted face	 -> faces from src faceset should be labeled
XSeg-dst	  - XSeg mask of dst face        -> faces from dst faceset should be labeled
XSeg-prd*XSeg-dst - the smallest area of both

if workspace\model folder contains trained XSeg model, then merger will use it,
otherwise you will get transparent mask by using XSeg-* modes.

Some screenshots:
label tool: https://i.imgur.com/aY6QGw1.jpg
trainer   : https://i.imgur.com/NM1Kn3s.jpg
merger    : https://i.imgur.com/glUzFQ8.jpg

example of the fake using 13 segmented dst faces
          : https://i.imgur.com/wmvyizU.gifv
2020-03-15 15:12:44 +04:00
Colombo
7c89077321 update core.imagelib 2020-03-13 19:27:13 +04:00
Colombo
a3a493bb93 _ 2020-03-13 10:44:50 +04:00
Colombo
61472cdaf7 global refactoring and fixes,
removed support of extracted(aligned) PNG faces. Use old builds to convert from PNG to JPG.

fanseg model file in facelib/ is renamed
2020-03-13 08:09:00 +04:00
Colombo
d731930537 fixes 2020-03-09 00:18:01 +04:00
Colombo
143792fd31 added fanseg for future WF segmentation model 2020-03-08 00:49:12 +04:00
Colombo
3b6ad4abf9 refactoring 2020-03-07 20:51:54 +04:00
Colombo
d6a685887f fix nick 2020-03-07 19:20:07 +04:00
Colombo
0bac399841 update leras 2020-03-07 16:05:53 +04:00
Colombo
ada60ccefe code refactoring,
lr_dropout is now disabled in pretraining mode
changed help message for lr_dropout and random_warp
2020-03-07 13:59:47 +04:00
Colombo
54548afe1a refactoring 2020-03-06 01:21:38 +04:00
Colombo
cd76425db3 update leras 2020-03-04 15:08:10 +04:00
Colombo
884913e35d upd leras 2020-03-02 07:09:39 +04:00
Colombo
757ec77e44 refactoring 2020-03-01 19:09:50 +04:00
Colombo
cbff72f597 _ 2020-02-29 15:53:48 +04:00
Colombo
6d122fd742 _ 2020-02-29 15:50:17 +04:00
Colombo
516e23584e _ 2020-02-29 15:48:31 +04:00
Colombo
803f7f9717 _ 2020-02-29 15:40:11 +04:00
Colombo
b093112f2f _ 2020-02-29 15:39:43 +04:00
Colombo
a21c55cf25 _ 2020-02-29 15:36:37 +04:00
Colombo
f55a65c304 _ 2020-02-29 15:34:27 +04:00
Colombo
55162d6e6c _ 2020-02-29 15:32:36 +04:00
Colombo
27e24d5d28 _ 2020-02-29 15:24:14 +04:00
Colombo
c900c65c31 _ 2020-02-29 15:20:17 +04:00
Colombo
63c0bdbf16 )_ 2020-02-29 15:10:59 +04:00
Colombo
98d3657cbc _ 2020-02-29 15:00:46 +04:00
Colombo
7f609d0f0a fix for linux 2020-02-29 14:49:46 +04:00
Colombo
dbf28eeebf fix for linux 2020-02-29 14:36:10 +04:00
Colombo
5eca4958b7 fix for linux 2020-02-29 14:34:08 +04:00
Colombo
fcbfbdd560 _ 2020-02-29 14:31:21 +04:00
Colombo
7e276a4ec7 _ 2020-02-29 14:12:53 +04:00
Colombo
7180076ecf fix 2020-02-29 13:31:36 +04:00
Colombo
90ae68ae61 fix input_in_time for linux 2020-02-29 11:05:04 +04:00
Colombo
59be114485 upd leras 2020-02-27 16:20:14 +04:00
Colombo
9860a38907 upd SampleGenerator 2020-02-27 09:58:46 +04:00