复现论文:DPStyler: Dynamic PromptStyler for Source-Free Domain Generalization

news/2025/2/24 23:24:09/

论文:[2403.16697] DPStyler: Dynamic PromptStyler for Source-Free Domain Generalization

github: 

TYLfromSEU/DPStyler: DPStyler: Dynamic PromptStyler for Source-Free Domain Generalization

论文:

这篇论文还是在PromptStyler:Prompt-driven Style Generation for Source-free Domain Generalization基础上对一些架构进行修改的。

Contribution

Style Generation Module:

dynamically refresh style by regenerating all style word vectors including Random and StyleMix between epochs.(randomly select one method)

Style Removal Module:

propose a domain uncertainty loss after encoder, to reduce specific style information and learn domain-invariant features

Model Ensemble:inference stage

for each text template, train a model and each model is involved in the inference process

Because introducing more randomness into the training process

大致代码流程

 

复现结果

PACS

VLCS

OfficeHome

DomainNet

avg

ResNet-50

92.1__-1.5

81.4__-2.1

70.5__-2.0

45.5__-2.5

72.4__-2.0

ViT-B/16

96.6__-0.5

80.8__-3.2

56.9__-2.0

PACS:

Art Painting

Cartoon

Photo

Sketch

avg

ResNet-50

92.7__-1.3

96.4__+1.1

99.6__0

79.6__-5.9

92.1__-1.5

ViT-B/16

97.6__-0.1

99.2__+0.3

99.9__0

89.8__-2.1

96.6__-0.5

ResNet-50:

92.4 96.5 99.6 78.4

93.4 96.2 99.5 81.7

92.2 96.5 99.6 78.6

ViT-B/16:

97.6 99.3 99.9 89.0

97.6 99.1 99.9 90.8

97.6 99.2 99.9 89.6

VLCS:

VLCS

Caletch

LableMe

SUN09

VOC2007

avg

ResNet-50

100__0

65.0__-8.3

73.9__+2.1

86.5__-2.5

81.4__-2.1

ViT-B/16

100__0

59.7__-9.4

80.4__+4.1

82.9__-7.6

80.8__-3.2

ResNet-50:

100 67.9 87.2 74.2 82.325

100 62.2 85.7 73.0 80.225

100 64.4 86.7 74.4 81.375

81.304

ViT-B/16:

100 62.4 88.5 77.6 82.125

100 61.1 83.1 75.5 79.925

100 55.7 77 88 80.175

80.7417

Office-Home:

Office-Home

Art

Clipart

Product

Real World

avg

ResNet-50

72.3__-1.3

49.1__-2.1

78.8__-3.3

81.6__-1.3

70.5__-2.0

ViT-B/16

ResNet-50:

72.2 49 78.5 81.5

72.4 48.9 78.6 81.5

72.4 49.3 79.3 81.7

ViT-B/16:

DomainNet:

DomainNet

Clipart

Infograph

Painting

Quickdraw

Real

Sketch

avg

ResNet-50

51.6__-3.8

40.6__-0.9

53.4__-2.6

6.7__-0.4

73.4__-4.1

47.3__-2.4

45.5__-2.5

ViT-B/16

68.6__-2.7

49.5__-1.1

65.3__-1.5

15.8__-0.4

80.7__-3.0

61.7__-2.7

56.9__-2.0

ResNet-50:

51.5 40.7 53.5 6.7 73.6 47.3

51.7 40.4 53.4 6.7 73.3 47.3

51.5 40.7 53.4 6.8 73.2 47.4

ViT-B/16

68.7 49.6 65.3 15.9 80.8 61.8

68.4 49.4 65.2 15.9 80.6 61.6

68.8 49.5 65.3 15.7 80.8 61.7

报错:

1、ERROR: Ignored the following versions that require a different python version:

23.10.0 Requires-Python >=3.8; 23.10.1 Requires-Python >=3.8; 23.11.0 Requires-Python >=3.8; 23.12.0 Requires-Python >=3.8; 23.12.1 Requires-Python >=3.8; 23.7.0 Requires-Python >=3.8; 23.9.0 Requires-Python >=3.8; 23.9.1 Requires-Python >=3.8; 24.1.0 Requires-Python >=3.8; 24.1.1 Requires-Python >=3.8; 24.10.0 Requires-Python >=3.9; 24.1a1 Requires-Python >=3.8; 24.2.0 Requires-Python >=3.8; 24.3.0 Requires-Python >=3.8; 24.4.0 Requires-Python >=3.8; 24.4.1 Requires-Python >=3.8; 24.4.2 Requires-Python >=3.8; 24.8.0 Requires-Python >=3.8 ERROR: Could not find a version that satisfies the requirement clip==1.0 (from versions: 0.0.1, 0.1.0, 0.2.0) ERROR: No matching distribution found for clip==1.0 failed CondaEnvException: Pip failed

原因:直接使用作者github上面的environment.yml文件发生报错。里面的配置有的用python3.7,有的用3.8很混乱。搞不懂作者是怎么配置的。

但是使用我之前配置的虚拟环境也可以这场运行这篇论文的代码。

链接:zhanghr2001/PromptTA: Source-free Domain Generalization

这是我之前复现这篇论文的环境,根据readme,配置到requirement.txt就可以。 

2、连接超时Connection timed out'

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='drive.google.com', port=443): Max retries exceeded with url: /uc?id=1gkbf_KaxoBws-GWT3XIPZ7BnkqbAxIFa (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f20626e8990>: Failed to establish a new connection: [Errno 110] Connection timed out'))

原因:要在作者给的github上的链接上面下载数据集,我用的之前的数据集,有一些问题。

3、ModuleNotFoundError: No module named ‘clip‘

命令:

pip install clip
pip install openai-clip

相关设置

1、数据集和模型名称设置

数据集:

PACS    VLCS     office_home_dg    domainnet:6个域文件+split文件夹(每个域的_train.txt和_test.txt)

模型名称:NET=resnet50_clip
vitb16_clip
vitl14_clip

2、运行命令

复现DPStyler命令:
sh run_clip_pacs.sh
sh run_clip_vlcs.sh
sh run_clip_office_home.sh
sh run_clip_domainnet.sh

这个作者还提供了复现PromptStyler的代码:

这个作者复现PromptStyler命令:
sh run_clip_pacs_ps.sh
sh run_clip_vlcs_ps.sh
sh run_clip_office_home_ps.sh
sh run_clip_domainnet_ps.sh


3、tensorboard命令查看

tensorboard --logdir ./output/vlcs/NS80_lr5_arcface_5_0.5_E100_resnet50_clip_R_wohead/seed3/tensorboard  --load_fast true  --port 6007

若显示端口被占用再加上 --load_fast true  --port 6007


http://www.ppmy.cn/news/1574713.html

相关文章

FPGA中利用fifo时钟域转换---慢时钟域转快时钟域

FPGA中利用fifo时钟域转换—慢时钟域转快时钟域 一、时间计算方法 FIFO的输入数据的时钟是40MHz&#xff0c;FIFO输出数据取60MHz&#xff0c;刚好是40MHz的1.5倍&#xff0c;将慢时钟域转快时钟域。另外&#xff0c;fifo输出的数据&#xff0c;要输出给上位机&#xff0c;一…

什么是 Vue 的自定义事件?如何触发和监听?

Vue 的自定义事件详解 什么是自定义事件&#xff1f; 在 Vue 中&#xff0c;自定义事件是组件之间通信的重要机制。自定义事件允许子组件向父组件发送消息&#xff0c;通常用于处理用户交互或异步操作的结果。这种机制使得组件间的通信更加灵活和解耦。 自定义事件的基本概念…

八大排序算法(1)插入排序-直接插入排序 和 希尔排序

直接插入排序&#xff08;Insertion Sort&#xff09; 直接插入排序是最基本的插入排序算法&#xff0c;工作原理如下&#xff1a; 从第二个元素开始&#xff0c;将其与前面已经排好序的部分进行比较。 找到合适的位置后&#xff0c;将该元素插入到合适的位置&#xff0c;同…

力扣——杨辉三角

题目链接&#xff1a; 链接 题目描述&#xff1a; 思路&#xff1a; 直接找规律&#xff0c;按照数学的思路来 每一行的列最大索引 < 行索引 实现代码&#xff1a; class Solution {public List<List<Integer>> generate(int numRows) {List<List<In…

一、Spring框架系统化学习路径

系统化的Spring框架学习路径 第1阶段&#xff1a;基础知识准备 Java基础 核心概念&#xff1a;面向对象、异常处理、集合框架、多线程等。JVM基础&#xff1a;内存模型、垃圾回收机制。 Maven或Gradle Maven&#xff1a;创建项目、依赖管理、生命周期。Gradle&#xff1a;基本…

【GPU驱动】OpenGLES图形管线渲染机制

OpenGLES图形管线渲染机制 OpenGL/ES 的渲染管线也是一个典型的图形流水线&#xff08;Graphics Pipeline&#xff09;&#xff0c;包括多个阶段&#xff0c;每个阶段都负责对图形数据进行处理。管线的核心目标是将图形数据转换为最终的图像&#xff0c;这些图像可以显示在屏幕…

百度首页上线 DeepSeek 入口,免费使用

大家好&#xff0c;我是小悟。 百度首页正式上线了 DeepSeek 入口&#xff0c;这一重磅消息瞬间在技术圈掀起了惊涛骇浪&#xff0c;各大平台都被刷爆了屏。 百度这次可太给力了&#xff0c;PC 端开放仅 1 小时&#xff0c;就有超千万人涌入体验。这速度&#xff0c;简直比火…

黑马点评 面试话术

MybatisPlus session技术会把jsessionid自动写到cookie里 ThreadLocal保证线程安全 用springmvc的自定义拦截器把登出用户 查看详情 获取当前用户并且返回 上传操作 登录查看详情 以下是不拦截的路径 在tomcat负载均衡时 如果不使用redis 直接用相互拷贝 1 浪费空间 2 如果此时…