Skip to content

Commit d63c1d9

Browse files
committed
esrgan: add model download for testing
1 parent 0651b46 commit d63c1d9

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

models/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Download models used in tests
2-
# (this is disabled unless VISP_TESTS is enabled)
1+
# Download models used in tests (happens only if VISP_TESTS is enabled)
32

43
message(STATUS "Checking for models/MobileSAM-F16.gguf")
54
file(DOWNLOAD
@@ -22,4 +21,10 @@ file(DOWNLOAD
2221
EXPECTED_HASH "SHA256=c9f241e96fb5a791f9494fc7d4c2dd793297ae95f05b8423f547d19bea465b81"
2322
SHOW_PROGRESS
2423
)
25-
# TODO: ESRGAN
24+
message(STATUS "Checking for models/RealESRGAN-x4plus_anime-6B-F16.gguf")
25+
file(DOWNLOAD
26+
"https://huggingface.co/Acly/Real-ESRGAN-GGUF/resolve/main/RealESRGAN-x4plus_anime-6B-F16.gguf"
27+
${CMAKE_CURRENT_LIST_DIR}/RealESRGAN-x4plus_anime-6B-F16.gguf
28+
EXPECTED_HASH "SHA256=b741e68720d7ad6251dee2120bf7579ef816ea16da18299b39f6cbcb0e13ecf0"
29+
SHOW_PROGRESS
30+
)

tests/test-models.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "util/string.hpp"
22
#include "visp/vision.hpp"
33

4-
54
#include "testing.hpp"
65

76
namespace visp {
@@ -48,7 +47,8 @@ VISP_BACKEND_TEST(test_birefnet)(backend_type bt) {
4847
image_data input = image_load(input_path.string().c_str());
4948
image_data output = birefnet_compute(model, input);
5049

51-
compare_images(name, output);
50+
float tolerance = bt == backend_type::cpu ? 0.01f : 0.3f; // TODO: GPU is non-deterministic
51+
compare_images(name, output, tolerance);
5252
}
5353

5454
VISP_BACKEND_TEST(test_migan)(backend_type bt) {
@@ -69,7 +69,7 @@ VISP_BACKEND_TEST(test_migan)(backend_type bt) {
6969
}
7070

7171
VISP_BACKEND_TEST(test_esrgan)(backend_type bt) {
72-
path model_path = test_dir().models / "RealESRGAN_x4plus_anime_6Bh.gguf";
72+
path model_path = test_dir().models / "RealESRGAN-x4plus_anime-6B-F16.gguf";
7373
path input_path = test_dir().input / "vase-and-bowl.jpg";
7474
std::string name = "esrgan";
7575
name += bt == backend_type::cpu ? "-cpu.png" : "-gpu.png";

0 commit comments

Comments
 (0)