Browse Source

Guess the use CPU/GPU if no --cpu --gpu option is provided

tags/v1.2.10
PommeDroid 2 years ago
parent
commit
5453bb7327
4 changed files with 8 additions and 6 deletions
  1. 5
    3
      argv.py
  2. 1
    1
      main.py
  3. 1
    1
      processing/gif.py
  4. 1
    1
      processing/image.py

+ 5
- 3
argv.py View File

@@ -8,6 +8,7 @@ from json import JSONDecodeError
import gpu_info
from main import main
from config import Config as conf
from gpu_info import get_info


def config_args(parser, args):
@@ -22,11 +23,12 @@ def config_args(parser, args):
return prefs

def config_gpu_ids():
gpu_ids = args.gpu
if args.cpu:
gpu_ids = None
elif gpu_ids is None:
gpu_ids = [0]
elif args.gpu:
gpu_ids = args.gpu
else:
gpu_ids = None if not gpu_info.get_info()['has_cuda'] else [0]
return gpu_ids

def config_args_in():

+ 1
- 1
main.py View File

@@ -46,7 +46,7 @@ def select_phases():
phases = [DressToCorrect(), CorrectToMask(), MaskToMaskref(),
MaskrefToMaskdet(), MaskdetToMaskfin(), MaskfinToMaskdet()]
if conf.args['steps']:
phases = phases[conf.args['steps'][0]:conf.args['steps'][1]]
phases = phases[conf.args['steps'][0]:conf.args['steps'][1]]
elif conf.args['overlay']:
phases = [ImageToCrop(), ImageToResized()] + phases + [ImageToOverlay()]
elif conf.args['auto_resize']:

+ 1
- 1
processing/gif.py View File

@@ -47,7 +47,7 @@ class SimpleGIFTransform(Process):
def execute(self):
"""
Execute all phases on each frames of the gif and recreate the gif
:return: <RGB[]> List of final transformed image
:return: None
"""
MultipleImageTransform(self.__temp_input_paths, self.__phases, self.__temp_output_paths).run()


+ 1
- 1
processing/image.py View File

@@ -73,7 +73,7 @@ class MultipleImageTransform(Process):
def execute(self):
"""
Execute all phases on the list of images
:return: <RGB[]> List of final transformed image
:return: None
"""

def process_one_image(a):

Loading…
Cancel
Save