Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: optional upscale when face not found #116

Closed
3 tasks done
brknsoul opened this issue Oct 1, 2023 · 1 comment
Closed
3 tasks done

[Feature]: optional upscale when face not found #116

brknsoul opened this issue Oct 1, 2023 · 1 comment
Labels
✔ done enhancement New feature or request

Comments

@brknsoul
Copy link

brknsoul commented Oct 1, 2023

First, confirm

  • I have read the instruction carefully
  • I have searched the existing issues
  • I have updated the extension to the latest version

What happened?

When batching images (eg: extracted frames from a video), if a face isn't found (for example, the subject in that particular frame is turned away), the upscaler won't happen on that image.

Steps to reproduce the problem

Img2Img batch a folder of files with one or more images without a face.
Use upscaler.

Sysinfo

Python 3.10.11 on Windows
Version: app=sd.next updated=2023-09-28 hash=ccae1ef0 url=https://github.com/vladmandic/automatic/tree/master
Latest published version: 01c466632d299c087a9033f1846558e94383d132 2023-10-01T01:08:55Z
Platform: arch=AMD64 cpu=Intel64 Family 6 Model 158 Stepping 11, GenuineIntel system=Windows release=Windows-10-10.0.19045-SP0
python=3.10.11
Using DirectML Backend

Relevant console log

*Successful detection and upscaling*

14:56:47-958701 DEBUG    Sampler: sampler=DPM++ 2M Karras config={'scheduler': 'karras'}                                                                       
100%|##########| 1/1 [00:01<00:00,  1.62s/it]
14:56:38-020571 STATUS   Working: source face index [0], target face index [0]                                                                                 
14:56:38-027597 STATUS   Detecting Source Face, Index = 0                                                                                                      
14:56:39-781531 STATUS   Detected: -33- y.o. Female                                                                                                            
14:56:39-783528 STATUS   Detecting Target Face, Index = 0                                                                                                      
14:56:41-548553 STATUS   Detected: -26- y.o. Female                                                                                                            
14:56:41-550555 STATUS   Swapping Source into Target                                                                                                           
14:56:42-795001 STATUS   Restoring the face with CodeFormer                                                                                                    
14:56:43-351562 STATUS   Upscaling with 4x_NMKD-Siax_200k scale = 2                                                                                            
14:56:43-431571 STATUS   Model loaded: type=ESRGAN model=E:\SM\Data\Packages\SD.Next Web UI\models\ESRGAN\4x_NMKD-Siax_200k.pth                                
Upscaling ---------------------------------------- 100% 0:00:00 0:00:01
14:56:45-739760 STATUS   Processed: images=1 time=12.51s its=1.20 memory={'ram': {'used': 5.99, 'total': 15.95}, 'gpu': {'used': 7.54, 'total': 7.98},         
                         'retries': 'DirectMLDevice', 'oom': 0}                                                                                                
14:56:46-003635 DEBUG    Saving: image="D:\zvidout\date0014-0000-20231001145646.png" type=PNG size=1024x768                                                    
14:56:47-921837 DEBUG    Processed: images=20 memory={'ram': {'used': 5.98, 'total': 15.95}, 'gpu': {'used': 7.54, 'total': 7.98}, 'retries': 'DirectMLDevice',
                         'oom': 0} op=batch                                                                                                                    


*Unsuccessful detection, no upscaling*

14:56:47-958701 DEBUG    Sampler: sampler=DPM++ 2M Karras config={'scheduler': 'karras'}                                                                       
100%|##########| 1/1 [00:01<00:00,  1.62s/it]
14:56:52-639873 STATUS   Working: source face index [0], target face index [0]                                                                                 
14:56:52-647108 STATUS   Detecting Source Face, Index = 0                                                                                                      
14:56:54-381563 STATUS   Detected: -33- y.o. Female                                                                                                            
14:56:54-383535 STATUS   Detecting Target Face, Index = 0                                                                                                      
14:56:55-718400 ERROR    Age Detection: No face with index = 0 was found                                                                                       
14:56:55-720400 ERROR    Gender Detection: No face with index = 0 was found                                                                                    
14:56:57-018473 ERROR    Age Detection: No face with index = 0 was found                                                                                       
14:56:57-020473 ERROR    Gender Detection: No face with index = 0 was found                                                                                    
14:56:57-128989 STATUS   No target face found for 0                                                                                                            
14:56:57-132958 STATUS   Processed: images=1 time=9.17s its=1.64 memory={'ram': {'used': 5.98, 'total': 15.95}, 'gpu': {'used': 7.54, 'total': 7.98},          
                         'retries': 'DirectMLDevice', 'oom': 0}                                                                                                
14:56:57-203027 DEBUG    Saving: image="D:\zvidout\date0015-0000-20231001145657.png" type=PNG size=512x384                                                     
14:56:57-738819 DEBUG    Processed: images=20 memory={'ram': {'used': 5.98, 'total': 15.95}, 'gpu': {'used': 7.54, 'total': 7.98}, 'retries': 'DirectMLDevice',
                         'oom': 0} op=batch

Additional information

Essentially, if one is batching images, one would like them to be all the same size, regardless of face detection or not.

@brknsoul brknsoul added bug Something isn't working new labels Oct 1, 2023
@Gourieff Gourieff added enhancement New feature or request and removed bug Something isn't working new labels Oct 1, 2023
@Gourieff
Copy link
Owner

Gourieff commented Oct 1, 2023

Ok, I will add it as an option in future updates

@Gourieff Gourieff changed the title Image doesn't upscale when face not found. [Feature]: optional upscale when face not found. Oct 1, 2023
@Gourieff Gourieff changed the title [Feature]: optional upscale when face not found. [Feature]: optional upscale when face not found Oct 1, 2023
Gourieff added a commit that referenced this issue Feb 2, 2024
@Gourieff Gourieff closed this as completed Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✔ done enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants