-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: Add Depth Anything PreProcessor #5548
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
feat: Add Depth Anything PreProcessor #5548
Conversation
|
Should we make this the default for depth models? |
Try and see. I need to experiment with a bit more to see if this is the better alternative. I'll test it a bit more later today and see if it should be the default. |
|
Added to Linear UI too. Not the default. Can change if people feel its better. |
|
Added output resolution. Also changed the if statements to match-case because we're using Python 3.10 and above already. If for some reason this needs to be reverted, let me know. |
hipsterusername
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works so good.
we should update to default in a future PR.
Just making this change in case there are other models added to the folder in the future
1640212 to
7cb49e6
Compare
|
It's already in this PR. Should I undo? |
|
Oh - No I think that's fine. We'll just want to RC. |
|
Does caching still need to be looked at @blessedcoolant ? |
Think so? One quick glance from them should sort it. I didn't see any glaring issues but maybe @lstein wants to handle the models better and store them in a better location. Right now I put them in the controlnets/annotators folder which is throwing warnings for incompatible models when booting coz they're not recognized. I thought I'll let Lincoln take a jab at that. |
|
I've moved the models to |
lstein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a problem with the caching per se, but we've generally avoided downloading big models files at unexpected times. Will these models be used frequently enough to make them into "core" models that are downloaded at install time? We do have a way of indicating that one model is dependent on others, which we are using for the relationship of IP Adapters and their encoders, and could use the same syntax to indicate that depth controlnet models require the presence of the Depth Anything models.
|
Not sure what was going on the first time but works great on macOS! |
I anticipate we want these to operate similarly with how we're handling midas right now - as a dependency installed early on. I think we can optimize the downloading outside of this PR, but we should make sure to do so. Thanks @Millu for testing on Mac. Can you make sure we follow up with an issue to track getting this model into an earlier install/config process? |
|
@blessedcoolant can merge after lint issues fixed. |
What type of PR is this? (check all applicable)
Have you discussed this change with the InvokeAI team?
Have you updated all relevant documentation?
Description
This adds the newly released Depth Anything to InvokeAI. A new node
Depth Anything Processorhas been added to generate depth maps using this new technique. https://depth-anything.github.ioAll related checkpoints will be downloaded automatically on first boot. The
DinoV2models will be loaded to your torch cache dir and the checkpoints pertaining to Depth Anything will be downloaded toany/annotators/depth_anything.Alternatively you can find the checkpoints here and download them to that folder: https://huggingface.co/spaces/LiheYoung/Depth-Anything/tree/main/checkpoints
This depth map can be used with any depth ControlNet model out there but the folks at DepthAnything have also released a custom fine tuned ControlNet model. From my limited testing, I still prefer the original depth model because this one seems to be producing weird artifacts. Not sure if that is a specific problem to Invoke or just the model itself. I'll test more later. Place these in your controlnet folder like your other ControlNets. You can get that here: https://huggingface.co/spaces/LiheYoung/Depth-Anything/tree/main/checkpoints_controlnet
Also available in the LinearUI
DepthAnything has three models
large,baseandsmall-- I've defaulted the processor to small but a user can change to the large model if they wish to do so. Small is way faster but obviously somewhat of a lesser quality.DepthAnything is now the default processor for depth controlnet models.
Screenshots
Merge Plan
DO NOT MERGE YET. Test it first and I'm sure the model caching can be done better. Coz I don't think I've done that at all. I would appreciate if @brandonrising or @lstein or anyone can take a look at that part of it.