---
title: Flux.1-dev-Controlnet-Surface-Normals
canonical_url: "https://www.modelscope.cn/models/jasperai/Flux.1-dev-Controlnet-Surface-Normals"
md_url: "https://www.modelscope.cn/models/jasperai/Flux.1-dev-Controlnet-Surface-Normals.md"
repository: jasperai/Flux.1-dev-Controlnet-Surface-Normals
last_updated: 2024-10-22
license: other
pipeline_tag: image-to-image
tasks:
  - image-to-image
base_model:
  - black-forest-labs/FLUX.1-dev
base_model_relation: finetune
parameters: 1.8B
tensor_type:
  - BF16
library_name:
  - pytorch
  - safetensors
  - diffusers
frameworks:
  - pytorch
downloads: 2319
stars: 1
tags:
  - ControlNet
---

# Flux.1-dev-Controlnet-Surface-Normals

> Flux.1-dev-Controlnet-Surface-Normals - jasperai 在 ModelScope 开源的模型。⚡ Flux.1-dev: Surface Normals ControlNet ⚡

jasperai/Flux.1-dev-Controlnet-Surface-Normals 是 ModelScope 魔搭社区上的 1.8B 参数image-to-image模型，采用 other 许可，基于 black-forest-labs/FLUX.1-dev 构建。

- **Repository**: jasperai/Flux.1-dev-Controlnet-Surface-Normals
- **License**: other
- **Tasks**: image-to-image
- **Parameters**: 1.8B
- **Base model**: black-forest-labs/FLUX.1-dev
- **Tags**: ControlNet
- **Downloads**: 2319
- **Stars**: 1
- **Last updated**: 2024-10-22

Source: https://www.modelscope.cn/models/jasperai/Flux.1-dev-Controlnet-Surface-Normals

---

# ⚡ Flux.1-dev: Surface Normals ControlNet ⚡

This is [Flux.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) ControlNet for Surface Normals map developed by Jasper research team.

<p align="center">
   <img style="width:700px;" src="examples/showcase.jpg">
</p>

# How to use
This model can be used directly with the `diffusers` library

```python
import torch
from diffusers.utils import load_image
from diffusers import FluxControlNetModel
from diffusers.pipelines import FluxControlNetPipeline

# Load pipeline
controlnet = FluxControlNetModel.from_pretrained(
  "jasperai/Flux.1-dev-Controlnet-Surface-Normals",
  torch_dtype=torch.bfloat16
)
pipe = FluxControlNetPipeline.from_pretrained(
  "black-forest-labs/FLUX.1-dev",
  controlnet=controlnet,
  torch_dtype=torch.bfloat16
)
pipe.to("cuda")

# Load a control image
control_image = load_image(
  "https://huggingface.co/jasperai/Flux.1-dev-Controlnet-Surface-Normals/resolve/main/examples/surface.jpg"
)

prompt = "a man showing stop sign in front of window"

image = pipe(
    prompt, 
    control_image=control_image,
    controlnet_conditioning_scale=0.6,
    num_inference_steps=28, 
    guidance_scale=3.5,
    height=control_image.size[1],
    width=control_image.size[0]
).images[0]
image
```

<p align="center">
   <img style="width:500px;" src="examples/output.jpg">
</p>

💡 Note: You can compute the conditioning map using the `NormalBaeDetector` from the `controlnet_aux` library

```python
from controlnet_aux import NormalBaeDetector
from diffusers.utils import load_image 

normal_bae = NormalBaeDetector.from_pretrained("lllyasviel/Annotators")

normal_bae.to("cuda")

# Load an image
im = load_image(
  "https://huggingface.co/jasperai/Flux.1-dev-Controlnet-Surface-Normals/resolve/main/examples/output.jpg"
)

surface = normal_bae(im)
```


# Training
This model was trained with surface normals maps computed with [Clipdrop's surface normals estimator model](https://clipdrop.co/apis/docs/portrait-surface-normals) as well as an open-souce surface normals estimation model such as Boundary Aware Encoder (BAE).

# Licence
This model falls under the [Flux.1-dev model licence](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md).
