FcF use unique resize strategy

This commit is contained in:
Qing
2022-09-04 16:00:42 +08:00
parent c5d7baec79
commit 2119a5f905
6 changed files with 105 additions and 18 deletions

View File

@@ -18,6 +18,9 @@ export enum LDMSampler {
function HDSettingBlock() {
const [hdSettings, setHDSettings] = useRecoilState(hdSettingsState)
if (!hdSettings.enabled) {
return <></>
}
const onStrategyChange = (value: HDStrategy) => {
setHDSettings({ hdStrategy: value })

View File

@@ -30,17 +30,6 @@ function ModelSettingBlock() {
) => {
return (
<div style={{ display: 'flex', gap: '12px' }}>
{/* <Tooltip content={name}>
<a
className="model-desc-link"
href={paperUrl}
target="_blank"
rel="noreferrer noopener"
>
Paper
</a>
</Tooltip> */}
<Tooltip content={githubUrl}>
<a
className="model-desc-link"
@@ -64,6 +53,17 @@ function ModelSettingBlock() {
</svg>
</a>
</Tooltip>
{/* <Tooltip content={name}>
<a
className="model-desc-link"
href={paperUrl}
target="_blank"
rel="noreferrer noopener"
>
Paper
</a>
</Tooltip> */}
</div>
)
}
@@ -123,6 +123,16 @@ function ModelSettingBlock() {
)
}
const renderFCFModelDesc = () => {
return (
<div>
FcF only support fixed size(512x512) image input. Lama Cleaner will take
care of resize and crop process, it still recommended applies to small
defects.
</div>
)
}
const renderOptionDesc = (): ReactNode => {
switch (setting.model) {
case AIModel.LAMA:
@@ -133,6 +143,8 @@ function ModelSettingBlock() {
return renderZITSModelDesc()
case AIModel.MAT:
return undefined
case AIModel.FCF:
return renderFCFModelDesc()
default:
return <></>
}
@@ -161,9 +173,15 @@ function ModelSettingBlock() {
case AIModel.MAT:
return renderModelDesc(
'Mask-Aware Transformer for Large Hole Image Inpainting',
'https://arxiv.org/pdf/2203.15270.pdf',
'https://arxiv.org/abs/2203.15270',
'https://github.com/fenglinglwb/MAT'
)
case AIModel.FCF:
return renderModelDesc(
'Keys to Better Image Inpainting: Structure and Texture Go Hand in Hand',
'https://arxiv.org/abs/2208.03382',
'https://github.com/SHI-Labs/FcF-Inpainting'
)
default:
return <></>
}

View File

@@ -8,6 +8,7 @@ export enum AIModel {
LDM = 'ldm',
ZITS = 'zits',
MAT = 'mat',
FCF = 'fcf',
}
export const fileState = atom<File | undefined>({
@@ -42,6 +43,7 @@ export interface HDSettings {
hdStrategyResizeLimit: number
hdStrategyCropTrigerSize: number
hdStrategyCropMargin: number
enabled: boolean
}
type ModelsHDSettings = { [key in AIModel]: HDSettings }
@@ -68,24 +70,35 @@ const defaultHDSettings: ModelsHDSettings = {
hdStrategyResizeLimit: 2048,
hdStrategyCropTrigerSize: 2048,
hdStrategyCropMargin: 128,
enabled: true,
},
[AIModel.LDM]: {
hdStrategy: HDStrategy.CROP,
hdStrategyResizeLimit: 1080,
hdStrategyCropTrigerSize: 1080,
hdStrategyCropMargin: 128,
enabled: true,
},
[AIModel.ZITS]: {
hdStrategy: HDStrategy.CROP,
hdStrategyResizeLimit: 1024,
hdStrategyCropTrigerSize: 1024,
hdStrategyCropMargin: 128,
enabled: true,
},
[AIModel.MAT]: {
hdStrategy: HDStrategy.CROP,
hdStrategyResizeLimit: 1024,
hdStrategyCropTrigerSize: 512,
hdStrategyCropMargin: 128,
enabled: true,
},
[AIModel.FCF]: {
hdStrategy: HDStrategy.CROP,
hdStrategyResizeLimit: 512,
hdStrategyCropTrigerSize: 512,
hdStrategyCropMargin: 128,
enabled: false,
},
}