复现论文:DPStyler:DynamicPromptStylerforSource-FreeDomainGen
- 手机
- 2025-08-27 18:12:02

论文:[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基础上对一些架构进行修改的。
ContributionStyle 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 ', 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
复现论文:DPStyler:DynamicPromptStylerforSource-FreeDomainGen由讯客互联手机栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“复现论文:DPStyler:DynamicPromptStylerforSource-FreeDomainGen”
上一篇
buildctl配置镜像加速