mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore: Add code attribution for the DWPoseDetector
This commit is contained in:
parent
67cbfeb33d
commit
7d80261d47
@ -6,45 +6,30 @@ from typing import Dict, List, Literal, Union
|
|||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from controlnet_aux import (
|
from controlnet_aux import (CannyDetector, ContentShuffleDetector, HEDdetector,
|
||||||
CannyDetector,
|
LeresDetector, LineartAnimeDetector,
|
||||||
ContentShuffleDetector,
|
LineartDetector, MediapipeFaceDetector,
|
||||||
HEDdetector,
|
MidasDetector, MLSDdetector, NormalBaeDetector,
|
||||||
LeresDetector,
|
OpenposeDetector, PidiNetDetector, SamDetector,
|
||||||
LineartAnimeDetector,
|
ZoeDetector)
|
||||||
LineartDetector,
|
|
||||||
MediapipeFaceDetector,
|
|
||||||
MidasDetector,
|
|
||||||
MLSDdetector,
|
|
||||||
NormalBaeDetector,
|
|
||||||
OpenposeDetector,
|
|
||||||
PidiNetDetector,
|
|
||||||
SamDetector,
|
|
||||||
ZoeDetector,
|
|
||||||
)
|
|
||||||
from controlnet_aux.util import HWC3, ade_palette
|
from controlnet_aux.util import HWC3, ade_palette
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
from pydantic import (BaseModel, ConfigDict, Field, field_validator,
|
||||||
|
model_validator)
|
||||||
|
|
||||||
from invokeai.app.invocations.primitives import ImageField, ImageOutput
|
from invokeai.app.invocations.primitives import ImageField, ImageOutput
|
||||||
from invokeai.app.invocations.util import validate_begin_end_step, validate_weights
|
from invokeai.app.invocations.util import (validate_begin_end_step,
|
||||||
from invokeai.app.services.image_records.image_records_common import ImageCategory, ResourceOrigin
|
validate_weights)
|
||||||
|
from invokeai.app.services.image_records.image_records_common import (
|
||||||
|
ImageCategory, ResourceOrigin)
|
||||||
from invokeai.app.shared.fields import FieldDescriptions
|
from invokeai.app.shared.fields import FieldDescriptions
|
||||||
from invokeai.backend.image_util.depth_anything import DepthAnythingDetector
|
from invokeai.backend.image_util.depth_anything import DepthAnythingDetector
|
||||||
from invokeai.backend.image_util.dwpose import DWPoseDetector
|
from invokeai.backend.image_util.dwpose import DWPoseDetector
|
||||||
|
|
||||||
from ...backend.model_management import BaseModelType
|
from ...backend.model_management import BaseModelType
|
||||||
from .baseinvocation import (
|
from .baseinvocation import (BaseInvocation, BaseInvocationOutput, Input,
|
||||||
BaseInvocation,
|
InputField, InvocationContext, OutputField,
|
||||||
BaseInvocationOutput,
|
WithMetadata, invocation, invocation_output)
|
||||||
Input,
|
|
||||||
InputField,
|
|
||||||
InvocationContext,
|
|
||||||
OutputField,
|
|
||||||
WithMetadata,
|
|
||||||
invocation,
|
|
||||||
invocation_output,
|
|
||||||
)
|
|
||||||
|
|
||||||
CONTROLNET_MODE_VALUES = Literal["balanced", "more_prompt", "more_control", "unbalanced"]
|
CONTROLNET_MODE_VALUES = Literal["balanced", "more_prompt", "more_control", "unbalanced"]
|
||||||
CONTROLNET_RESIZE_VALUES = Literal[
|
CONTROLNET_RESIZE_VALUES = Literal[
|
||||||
@ -625,7 +610,7 @@ class DepthAnythingImageProcessorInvocation(ImageProcessorInvocation):
|
|||||||
resolution: int = InputField(default=512, ge=64, multiple_of=64, description=FieldDescriptions.image_res)
|
resolution: int = InputField(default=512, ge=64, multiple_of=64, description=FieldDescriptions.image_res)
|
||||||
offload: bool = InputField(default=False)
|
offload: bool = InputField(default=False)
|
||||||
|
|
||||||
def run_processor(self, image):
|
def run_processor(self, image: Image.Image):
|
||||||
depth_anything_detector = DepthAnythingDetector()
|
depth_anything_detector = DepthAnythingDetector()
|
||||||
depth_anything_detector.load_model(model_size=self.model_size)
|
depth_anything_detector.load_model(model_size=self.model_size)
|
||||||
|
|
||||||
|
@ -34,6 +34,11 @@ def draw_pose(pose, H, W, draw_face=True, draw_body=True, draw_hands=True, resol
|
|||||||
|
|
||||||
|
|
||||||
class DWPoseDetector:
|
class DWPoseDetector:
|
||||||
|
"""
|
||||||
|
Code from the original implementation of the DWPose Detector.
|
||||||
|
Credits: https://github.com/IDEA-Research/DWPose
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.pose_estimation = Wholebody()
|
self.pose_estimation = Wholebody()
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Code from the original DWPose Implementation: https://github.com/IDEA-Research/DWPose
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Code from the original DWPose Implementation: https://github.com/IDEA-Research/DWPose
|
||||||
|
|
||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Code from the original DWPose Implementation: https://github.com/IDEA-Research/DWPose
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# Code from the original DWPose Implementation: https://github.com/IDEA-Research/DWPose
|
||||||
|
# Modified pathing to suit Invoke
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
Loading…
Reference in New Issue
Block a user