Skip to content

Commit 5ee8d43

Browse files
committed
fix: models in own folders, ci
1 parent 1e467e7 commit 5ee8d43

File tree

4 files changed

+24
-51
lines changed

4 files changed

+24
-51
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Build waifu2x! 🖼️
22

33
on:
44
push:
5-
tags:
6-
- "*"
5+
branches:
6+
- master
77

88
env:
99
XCBUILD_PATH: "build/Release"
@@ -17,9 +17,10 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
lfs: true
20+
submodules: true
2021

2122
- name: Install Dependencies 🚀
22-
run: brew install create-dmg tuist
23+
run: brew install tuist create-dmg
2324
env:
2425
HOMEBREW_NO_INSTALL_CLEANUP: 1
2526
HOMEBREW_NO_AUTO_UPDATE: 1
@@ -37,17 +38,18 @@ jobs:
3738

3839
- name: Generate project 🚀
3940
#run: TUIST_BUNDLE=true tuist generate
40-
run: tuist generate
41+
run: TUIST_BUNDLE=true tuist generate
4142

4243
- name: Release Build 🔨
43-
run: tuist build --configuration Release --build-output-path build
44+
run: tuist build --configuration Release --build-output-path build
4445

4546
#- name: Check Send signature
4647
# run: codesign --verify -vvvv --deep --strict "${XCBUILD_PATH}/${MACOS_APP_ARTIFACT}"
4748

4849
- name: Create Disk Image 💿
4950
run: |
5051
mkdir Artifacts
52+
5153
cp ${XCBUILD_PATH}/*.dmg Artifacts
5254
cp ${XCBUILD_PATH}/*.zip Artifacts
5355

Project.swift

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ let project = Project(
1212
infoPlist: .file(path: "Waifu2X/Info.plist"),
1313
sources: ["Waifu2X/Sources/**", "Waifu2X/backend/realsr-ncnn-vulkan/src/realsr.cpp", "Waifu2X/backend/waifu2x-ncnn-vulkan/src/waifu2x.cpp"],
1414
resources: [
15-
.folderReference(path: "Waifu2X/backend/waifu2x-ncnn-vulkan/models_waifu2x"),
16-
.folderReference(path: "Waifu2X/backend/realsr-ncnn-vulkan/models_realsr"),
15+
.folderReference(path: "Waifu2X/backend/waifu2x-ncnn-vulkan/models/models-cunet"),
16+
.folderReference(path: "Waifu2X/backend/waifu2x-ncnn-vulkan/models/models-upconv_7_anime_style_art_rgb"),
17+
.folderReference(path: "Waifu2X/backend/waifu2x-ncnn-vulkan/models/models-upconv_7_photo"),
18+
.folderReference(path: "Waifu2X/backend/realsr-ncnn-vulkan/models/models-DF2K"),
19+
.folderReference(path: "Waifu2X/backend/realsr-ncnn-vulkan/models/models-DF2K_JPEG"),
1720
"Waifu2X/Resources/**",
1821

1922
],
@@ -25,27 +28,17 @@ let project = Project(
2528
zip -r "Waifu2X.zip" "Waifu2X.app"
2629
""",
2730
name: "ZIP",
28-
outputPaths: ["Waifu2X.zip"]
31+
outputPaths: ["${BUILT_PRODUCTS_DIR}/Waifu2X.zip"]
2932
),
3033
.post(
3134
script: """
3235
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"
3336
cd "${BUILT_PRODUCTS_DIR}"
3437
rm -rf "Waifu2X.dmg"
35-
create-dmg \\
36-
--volname Waifu2X \\
37-
--background "${SRCROOT}/Waifu2X/dmg/dmg-background.tiff" \
38-
--window-pos 200 120 \\
39-
--window-size 660 420 \\
40-
--text-size 12 \\
41-
--icon-size 160 \\
42-
--icon Waifu2X.app 180 170 \\
43-
--app-drop-link 480 170 \
44-
Waifu2X.dmg \
45-
Waifu2X.app
38+
create-dmg --volname Waifu2X --background "${SRCROOT}/Waifu2X/dmg/dmg-background.tiff" --window-pos 200 120 --window-size 660 420 --text-size 12 --icon-size 160 --icon Waifu2X.app 180 170 --app-drop-link 480 170 Waifu2X.dmg Waifu2X.app
4639
""",
4740
name: "DMG",
48-
outputPaths: ["Waifu2X.dmg"]
41+
outputPaths: ["${BUILT_PRODUCTS_DIR}/Waifu2X.dmg"]
4942
),
5043
] : [],
5144
dependencies: [
@@ -88,13 +81,6 @@ let project = Project(
8881
""",
8982
name: "ConfigureCMake"
9083
),
91-
.pre(
92-
script: """
93-
if [ -d "Waifu2X/backend/waifu2x-ncnn-vulkan/models" ]; then
94-
mv Waifu2X/backend/waifu2x-ncnn-vulkan/models Waifu2X/backend/waifu2x-ncnn-vulkan/models_waifu2x
95-
fi
96-
""", name: "Models"
97-
),
9884
.pre(
9985
script: """
10086
sed -i '' $'s/#include "net.h"/#include <ncnn\\/ncnn\\/net.h>/g\ns/#include "gpu.h"/#include <ncnn\\/ncnn\\/gpu.h>/g\ns/#include "layer.h"/#include <ncnn\\/ncnn\\/layer.h>/g' Waifu2X/backend/waifu2x-ncnn-vulkan/src/waifu2x.h
@@ -123,13 +109,6 @@ let project = Project(
123109
""",
124110
name: "ConfigureCMake"
125111
),
126-
.pre(
127-
script: """
128-
if [ -d "Waifu2X/backend/realsr-ncnn-vulkan/models" ]; then
129-
mv Waifu2X/backend/realsr-ncnn-vulkan/models Waifu2X/backend/realsr-ncnn-vulkan/models_realsr
130-
fi
131-
""", name: "Models"
132-
),
133112
.pre(
134113
script: """
135114
sed -i '' $'s/#include "net.h"/#include <ncnn\\/ncnn\\/net.h>/g\ns/#include "gpu.h"/#include <ncnn\\/ncnn\\/gpu.h>/g\ns/#include "layer.h"/#include <ncnn\\/ncnn\\/layer.h>/g' Waifu2X/backend/realsr-ncnn-vulkan/src/realsr.h

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,11 @@ brew install tuist cmake git-lfs
9393

9494

9595
# clone this repo first
96-
git clone --recursive --depth=1 https://github.com/EETagent/waifu2x-ncnn-vulkan-macos
96+
git clone --recurse-submodules --depth=1 https://github.com/EETagent/waifu2x-ncnn-vulkan-macos
9797

9898
# change directory
9999
cd waifu2x-ncnn-vulkan-macos
100100

101-
# rename models
102-
mv Waifu2X/backend/realsr-ncnn-vulkan/models Waifu2X/backend/realsr-ncnn-vulkan/models_realsr
103-
mv Waifu2X/backend/waifu2x-ncnn-vulkan/models Waifu2X/backend/waifu2x-ncnn-vulkan/models_waifu2x
104-
105-
# git lfs
106-
git lfs install
107-
git lfs pull
108-
109101
# check your cmake installation
110102
which cmake
111103

Waifu2X/Sources/waifu2xmac.mm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,23 +328,23 @@ + (NSImage *)input:(NSArray<NSString *> *)inputpaths
328328
if (backend == BackendWaifu2X) {
329329
if (noise == -1)
330330
{
331-
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_waifu2x/%@/scale2.0x_model.param", model] ofType:nil];
332-
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_waifu2x/%@/scale2.0x_model.bin", model] ofType:nil];
331+
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/scale2.0x_model.param", model] ofType:nil];
332+
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/scale2.0x_model.bin", model] ofType:nil];
333333
}
334334
else if (scale == 1)
335335
{
336-
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_waifu2x/%@/noise%d_model.param", model, noise] ofType:nil];
337-
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_waifu2x/%@/noise%d_model.bin", model, noise] ofType:nil];
336+
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/noise%d_model.param", model, noise] ofType:nil];
337+
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/noise%d_model.bin", model, noise] ofType:nil];
338338
}
339339
else if (scale == 2)
340340
{
341-
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_waifu2x/%@/noise%d_scale2.0x_model.param", model, noise] ofType:nil];
342-
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_waifu2x/%@/noise%d_scale2.0x_model.bin", model, noise] ofType:nil];
341+
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/noise%d_scale2.0x_model.param", model, noise] ofType:nil];
342+
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/noise%d_scale2.0x_model.bin", model, noise] ofType:nil];
343343
}
344344
} else if (backend == BackendRealSR) {
345345
if (scale == 4) {
346-
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_realsr/%@/x%d.param", model, scale] ofType:nil];
347-
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"models_realsr/%@/x%d.bin", model, scale] ofType:nil];
346+
parampath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/x%d.param", model, scale] ofType:nil];
347+
modelpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/x%d.bin", model, scale] ofType:nil];
348348
}
349349
}
350350

0 commit comments

Comments
 (0)