Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
009f347d
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
009f347d
编写于
12月 15, 2022
作者:
Z
zh-hike
提交者:
Walter
1月 04, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改空格等代码规范
上级
f83ff59c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
36 addition
and
55 deletion
+36
-55
docs/zh_CN/training/semi_supervised_learning/FixMatchCCSSL.md
.../zh_CN/training/semi_supervised_learning/FixMatchCCSSL.md
+2
-2
ppcls/arch/__init__.py
ppcls/arch/__init__.py
+0
-2
ppcls/arch/backbone/model_zoo/wideresnet.py
ppcls/arch/backbone/model_zoo/wideresnet.py
+1
-1
ppcls/configs/ssl/FixMatchCCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml
.../ssl/FixMatchCCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml
+14
-29
ppcls/configs/ssl/FixMatchCCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml
...gs/ssl/FixMatchCCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml
+1
-3
ppcls/data/preprocess/__init__.py
ppcls/data/preprocess/__init__.py
+1
-5
ppcls/engine/train/train_fixmatch_ccssl.py
ppcls/engine/train/train_fixmatch_ccssl.py
+3
-7
ppcls/loss/softsuploss.py
ppcls/loss/softsuploss.py
+14
-6
未找到文件。
docs/zh_CN/training/semi_supervised_learning/FixMatchCCSSL.md
浏览文件 @
009f347d
...
...
@@ -33,13 +33,13 @@
<td>
pytorch版本
</td>
<td></td>
<td></td>
<td></td>
<td>
95.54
</td>
</tr>
<tr>
<td>
paddle版本
</td>
<td></td>
<td></td>
<td></td>
<td>
95.61
</td>
</tr>
</table>
cifar10上,paddle版本的配置文件及训练好的模型如下表所示
...
...
ppcls/arch/__init__.py
浏览文件 @
009f347d
...
...
@@ -14,8 +14,6 @@
import
copy
import
importlib
from
pyexpat
import
features
import
paddle.nn
as
nn
from
paddle.jit
import
to_static
from
paddle.static
import
InputSpec
...
...
ppcls/arch/backbone/model_zoo/wideresnet.py
浏览文件 @
009f347d
...
...
@@ -235,4 +235,4 @@ def WideResNet(depth,
num_classes
=
num_classes
,
proj
=
proj
,
low_dim
=
low_dim
,
**
kwargs
)
**
kwargs
)
\ No newline at end of file
ppcls/configs/ssl/FixMatchCCSSL/FixMatchCCSSL_cifar100_10000_4gpu.yaml
浏览文件 @
009f347d
...
...
@@ -30,8 +30,8 @@ Arch:
name
:
WideResNet
widen_factor
:
8
depth
:
28
dropout
:
0
# CCSSL为 drop_rate
num_classes
:
&sign_num_classes
100
dropout
:
0
num_classes
:
100
low_dim
:
64
proj
:
true
proj_after
:
false
...
...
@@ -59,14 +59,6 @@ UnLabelLoss:
-
SoftSupConLoss
:
weight
:
1.0
temperature
:
0.07
# - CCSSLLoss:
# CELoss:
# weight: 1.0
# reduction: "none"
# SoftSupConLoss:
# weight: 1.0
# temperature: 0.07
# weight: 1.
Optimizer
:
name
:
Momentum
...
...
@@ -80,8 +72,8 @@ Optimizer:
num_training_steps
:
524800
DataLoader
:
mean
:
&sign_mean
[
0.5071
,
0.4867
,
0.4408
]
std
:
&sign_std
[
0.2675
,
0.2565
,
0.2761
]
mean
:
[
0.5071
,
0.4867
,
0.4408
]
std
:
[
0.2675
,
0.2565
,
0.2761
]
Train
:
dataset
:
name
:
CIFAR100SSL
...
...
@@ -99,11 +91,11 @@ DataLoader:
padding_mode
:
"
reflect"
-
ToTensor
:
-
Normalize
:
mean
:
*sign_mean
std
:
*sign_std
mean
:
[
0.5071
,
0.4867
,
0.4408
]
std
:
[
0.2675
,
0.2565
,
0.2761
]
sampler
:
name
:
DistributedBatchSampler
# DistributedBatchSampler
name
:
DistributedBatchSampler
batch_size
:
16
drop_last
:
true
shuffle
:
true
...
...
@@ -111,8 +103,6 @@ DataLoader:
num_workers
:
4
use_shared_memory
:
true
UnLabelTrain
:
dataset
:
name
:
CIFAR100SSL
...
...
@@ -129,8 +119,8 @@ DataLoader:
padding_mode
:
'
reflect'
-
ToTensor
:
-
Normalize
:
mean
:
*sign_mean
std
:
*sign_std
mean
:
[
0.5071
,
0.4867
,
0.4408
]
std
:
[
0.2675
,
0.2565
,
0.2761
]
transform_s1
:
-
RandomHorizontalFlip
:
...
...
@@ -144,8 +134,8 @@ DataLoader:
m
:
10
-
ToTensor
:
-
Normalize
:
mean
:
*sign_mean
std
:
*sign_std
mean
:
[
0.5071
,
0.4867
,
0.4408
]
std
:
[
0.2675
,
0.2565
,
0.2761
]
transform_s2
:
-
RandomResizedCrop
:
...
...
@@ -163,12 +153,9 @@ DataLoader:
-
RandomGrayscale
:
p
:
0.2
-
ToTensor
:
# - Normalize:
# mean: *sign_mean
# std: *sign_std
sampler
:
name
:
DistributedBatchSampler
# DistributedBatchSampler
name
:
DistributedBatchSampler
batch_size
:
112
drop_last
:
true
shuffle
:
true
...
...
@@ -185,8 +172,8 @@ DataLoader:
transform_ops
:
-
ToTensor
:
-
Normalize
:
mean
:
*sign_mean
std
:
*sign_std
mean
:
[
0.5071
,
0.4867
,
0.4408
]
std
:
[
0.2675
,
0.2565
,
0.2761
]
sampler
:
name
:
DistributedBatchSampler
batch_size
:
16
...
...
@@ -196,8 +183,6 @@ DataLoader:
num_workers
:
4
use_shared_memory
:
true
Metric
:
Eval
:
-
TopkAcc
:
...
...
ppcls/configs/ssl/FixMatchCCSSL/FixMatchCCSSL_cifar10_4000_4gpu.yaml
浏览文件 @
009f347d
...
...
@@ -7,7 +7,7 @@ Global:
eval_during_train
:
true
eval_interval
:
1
epochs
:
1024
iter_per_epoch
:
40
iter_per_epoch
:
1024
print_batch_step
:
20
use_visualdl
:
false
use_dali
:
false
...
...
@@ -196,8 +196,6 @@ DataLoader:
num_workers
:
4
use_shared_memory
:
true
Metric
:
Eval
:
-
TopkAcc
:
...
...
ppcls/data/preprocess/__init__.py
浏览文件 @
009f347d
...
...
@@ -51,13 +51,10 @@ from paddle.vision.transforms import Pad as Pad_paddle_vision
from
ppcls.data.preprocess.batch_ops.batch_operators
import
MixupOperator
,
CutmixOperator
,
OpSampler
,
FmixOperator
from
ppcls.data.preprocess.batch_ops.batch_operators
import
MixupCutmixHybrid
import
numpy
as
np
from
PIL
import
Image
import
random
def
transform
(
data
,
ops
=
[]):
""" transform """
for
op
in
ops
:
...
...
@@ -120,5 +117,4 @@ class TimmAutoAugment(RawTimmAutoAugment):
if
isinstance
(
img
,
Image
.
Image
):
img
=
np
.
asarray
(
img
)
return
img
\ No newline at end of file
return
img
\ No newline at end of file
ppcls/engine/train/train_fixmatch_ccssl.py
浏览文件 @
009f347d
from
__future__
import
absolute_import
,
division
,
print_function
import
time
from
turtle
import
update
import
paddle
...
...
@@ -11,11 +8,11 @@ from ppcls.utils import profiler
from
paddle.nn
import
functional
as
F
import
numpy
as
np
import
paddle
# from reprod_log import ReprodLogger
def
train_epoch_fixmatch_ccssl
(
engine
,
epoch_id
,
print_batch_step
):
print
(
engine
.
model
.
state_dict
().
keys
())
assert
1
==
0
tic
=
time
.
time
()
if
not
hasattr
(
engine
,
'train_dataloader_iter'
):
engine
.
train_dataloader_iter
=
iter
(
engine
.
train_dataloader
)
...
...
@@ -135,5 +132,4 @@ def get_loss(engine,
loss_dict
[
k
]
=
v
loss_dict
[
'loss'
]
=
loss_dict_label
[
'loss'
]
+
unlabel_loss
[
'loss'
]
return
loss_dict
,
logits_x
\ No newline at end of file
return
loss_dict
,
logits_x
\ No newline at end of file
ppcls/loss/softsuploss.py
浏览文件 @
009f347d
"""
CCSSL loss
author: zhhike
"""
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
paddle.nn
as
nn
...
...
@@ -65,5 +74,4 @@ class SoftSupConLoss(nn.Layer):
if
reduction
==
'mean'
:
loss
=
loss
.
mean
()
return
{
"SoftSupConLoss"
:
loss
}
\ No newline at end of file
return
{
"SoftSupConLoss"
:
loss
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录