Example #1
0
# import vision essentials
import numpy as np
from tqdm import tqdm

from mmd.utils.MLogger import MLogger

# 指数表記なし、有効小数点桁数6、30を超えると省略あり、一行の文字数200
np.set_printoptions(suppress=True, precision=6, threshold=30, linewidth=200)

if os.name == 'posix':
    import resource
    rlimit = resource.getrlimit(resource.RLIMIT_NOFILE)
    resource.setrlimit(resource.RLIMIT_NOFILE, (rlimit[1], rlimit[1]))
    os.environ['PYOPENGL_PLATFORM'] = 'egl'

logger = MLogger(__name__, level=MLogger.DEBUG)


def execute(args):
    try:
        logger.info('人物姿勢推定開始: {0}',
                    args.img_dir,
                    decoration=MLogger.DECORATION_BOX)

        if not os.path.exists(args.img_dir):
            logger.error("指定された処理用ディレクトリが存在しません。: {0}",
                         args.img_dir,
                         decoration=MLogger.DECORATION_BOX)
            return False

        torch.backends.cudnn.benchmark = True
Example #2
0
# -*- coding: utf-8 -*-
import argparse
import time
import os

from mmd.utils.MLogger import MLogger

logger = MLogger(__name__)


def show_worked_time(elapsed_time):
    # 経過秒数を時分秒に変換
    td_m, td_s = divmod(elapsed_time, 60)
    td_h, td_m = divmod(td_m, 60)

    if td_m == 0:
        worked_time = "{0:02d}秒".format(int(td_s))
    elif td_h == 0:
        worked_time = "{0:02d}分{1:02d}秒".format(int(td_m), int(td_s))
    else:
        worked_time = "{0:02d}時間{1:02d}分{2:02d}秒".format(
            int(td_h), int(td_m), int(td_s))

    return worked_time


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--parent-dir',
                        type=str,
                        dest='parent_dir',
Example #3
0
from tqdm import tqdm
from PIL import Image
import traceback
import numpy as np
import shutil
import re
import pathlib

from skimage import exposure, restoration
from skimage.color import rgb2gray
from skimage import io, exposure, img_as_float, img_as_ubyte
import warnings

from mmd.utils.MLogger import MLogger

logger = MLogger(__name__)


def execute(args):
    try:
        logger.info("動画準備開始", decoration=MLogger.DECORATION_BOX)

        if not os.path.exists(args.video_file):
            logger.error("指定されたファイルパスが存在しません。\n{0}",
                         args.video_file,
                         decoration=MLogger.DECORATION_BOX)
            return False, None

        # 親パス(指定がなければ動画のある場所。Colabはローカルで作成するので指定あり想定)
        base_path = str(pathlib.Path(args.video_file).parent
                        ) if not args.parent_dir else args.parent_dir
Example #4
0
import math

import re
import numpy as np
from tqdm import tqdm
import datetime
import subprocess

from mmd.utils.MLogger import MLogger
from mmd.mmd.VmdData import VmdMorphFrame, VmdMotion
from mmd.mmd.PmxData import PmxModel
from mmd.mmd.VmdWriter import VmdWriter
from mmd.utils.MServiceUtils import get_file_encoding
from mmd.monaural_adapter import FFMPEGMonauralProcessAudioAdapter

logger = MLogger(__name__, level=1)

SEPARATOR = "----------"

def execute(args):
    try:
        logger.info('リップ生成処理開始: {0}', args.audio_dir, decoration=MLogger.DECORATION_BOX)

        if not os.path.exists(args.audio_dir):
            logger.error("指定された音声ディレクトリパスが存在しません。\n{0}", args.audio_dir, decoration=MLogger.DECORATION_BOX)
            return False

        if not os.path.exists(args.lyrics_file):
            logger.error("指定された歌詞ファイルパスが存在しません。\n{0}", args.lyrics_file, decoration=MLogger.DECORATION_BOX)
            return False