Commit graph

75 commits

Author SHA1 Message Date
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
Colombo
1898bd6881 _ 2020-02-26 23:50:42 +04:00
Colombo
f07bbd5fb0 update leras 2020-02-26 13:32:32 +04:00
Colombo
0324592b67 update leras/layers.py 2020-02-24 22:23:08 +04:00
Colombo
f1d115b63b added experimental face type 'whole_face'
Basic usage instruction: https://i.imgur.com/w7LkId2.jpg

	'whole_face' requires skill in Adobe After Effects.

	For using whole_face you have to extract whole_face's by using
	4) data_src extract whole_face
	and
	5) data_dst extract whole_face
	Images will be extracted in 512 resolution, so they can be used for regular full_face's and half_face's.

	'whole_face' covers whole area of face include forehead in training square,
	but training mask is still 'full_face'
	therefore it requires manual final masking and composing in Adobe After Effects.

added option 'masked_training'
	This option is available only for 'whole_face' type.
	Default is ON.
	Masked training clips training area to full_face mask,
	thus network will train the faces properly.
	When the face is trained enough, disable this option to train all area of the frame.
	Merge with 'raw-rgb' mode, then use Adobe After Effects to manually mask, tune color, and compose whole face include forehead.
2020-02-21 16:21:04 +04:00
Colombo
7a790489f2 fix SubprocessorBase.py 2020-02-19 22:09:45 +04:00
Colombo
7a9cd6379f bug fixes 2020-02-19 15:27:22 +04:00