├── .gitignore ├── README.md ├── data ├── fashion_mnist-test.png ├── fashion_mnist-train.png ├── mnist-test.png └── mnist-train.png ├── gen_summary.py ├── img ├── RingLoss.png ├── arcface.png ├── e^x.png ├── intro.png ├── softmax_feature2.png ├── softmax_normweight_feature2.png ├── softmax_removebias_feature2.png └── softmax_weightdecay_feature2.png ├── src ├── common.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale5 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── fashion_mnist.softmax.weight_decay1e-3.feature2 │ ├── config.py │ ├── draw.py │ └── train.py ├── misc.py ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale10 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale20 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale5 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale50 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.normweight │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.ringloss.1 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2.withbias │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-3.feature2 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-5.feature2.lr.1e-4 │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-5.feature2.normweight │ ├── config.py │ ├── draw.py │ └── train.py ├── mnist.softmax.weight_decay1e-5.feature2.withbias │ ├── config.py │ ├── draw.py │ └── train.py └── mnist.softmax.weight_decay1e-5.feature2 │ ├── config.py │ ├── draw.py │ └── train.py ├── summary ├── fashion_mnist_summary.txt └── mnist_summary.txt ├── train_log ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.normweight │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── fashion_mnist.softmax.weight_decay1e-3.feature2 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale1 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale10 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale20 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale5 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normface.scale50 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.normweight │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.ringloss.1 │ ├── curve │ │ ├── R.png │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2.withbias │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-3.feature2 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-5.feature2.lr.1e-4 │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-5.feature2.normweight │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt ├── mnist.softmax.weight_decay1e-5.feature2.withbias │ ├── curve │ │ ├── curve-epoch.png │ │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt └── mnist.softmax.weight_decay1e-5.feature2 │ ├── curve │ ├── curve-epoch.png │ └── curve-step.png │ ├── feature-best-accuracy.png │ └── worklog.txt └── view_data.py /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | __pycache__ 4 | 5 | # not upload model and status_info file 6 | models 7 | _info 8 | 9 | # not upload data 10 | *.pt 11 | *-ubyte 12 | 13 | !*.png 14 | -------------------------------------------------------------------------------- /data/fashion_mnist-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/data/fashion_mnist-test.png -------------------------------------------------------------------------------- /data/fashion_mnist-train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/data/fashion_mnist-train.png -------------------------------------------------------------------------------- /data/mnist-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/data/mnist-test.png -------------------------------------------------------------------------------- /data/mnist-train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/data/mnist-train.png -------------------------------------------------------------------------------- /gen_summary.py: -------------------------------------------------------------------------------- 1 | from glob import glob 2 | import os 3 | import argparse 4 | import re 5 | from tabulate import tabulate 6 | 7 | from IPython import embed 8 | 9 | filter_keys = ['weight_decay1e-5', 'withbias', 'lr.1e-4'] 10 | filter_lists = [ 11 | 'mnist.softmax.weight_decay1e-5.feature2', 12 | 'mnist.softmax.weight_decay1e-5.feature2.withbias', 13 | 'mnist.softmax.weight_decay1e-5.feature2.normweight', 14 | 'mnist.softmax.weight_decay1e-5.feature2.lr.1e-4', 15 | 'mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias', 16 | 'mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias', 17 | 'mnist.softmax.weight_decay1e-3.feature2.withbias', 18 | ] 19 | 20 | def gen_summary(dataset='mnist'): 21 | assert dataset in ['mnist', 'fashion_mnist'] 22 | os.chdir('train_log') 23 | 24 | experiments = glob('{}.*'.format(dataset)) 25 | experiments = [x for x in experiments if x not in filter_lists] 26 | 27 | header = ['experiment', 'best-acc', 'best-epoch'] 28 | result = [] 29 | for element in experiments: 30 | file = '{}/worklog.txt'.format(element) 31 | ret = re.search("The best accuracy model is: {'accuracy': (.*), 'epoch': (.*)}", open(file, mode='r').read(), flags=0) 32 | if ret != None: 33 | acc = ret.group(1) 34 | epoch = ret.group(2) 35 | result.append([element,float(acc), epoch]) 36 | continue 37 | ret = re.search("The best accuracy model is: {'epoch': (.*), 'accuracy': (.*)}", open(file, mode='r').read(), flags=0) 38 | if ret != None: 39 | acc = ret.group(2) 40 | epoch = ret.group(1) 41 | result.append([element, float(acc), epoch]) 42 | continue 43 | print('not find result: {}'.format(element)) 44 | 45 | table = sorted(result, key=lambda item: item[1]) 46 | 47 | t = tabulate(table, header, tablefmt='orgtbl') 48 | lines = t.split('\n') 49 | lines[1] = lines[1].replace('+', '|') 50 | t_wiki = '\n'.join(lines) 51 | 52 | print(t_wiki) 53 | fname = '{}_summary.txt'.format(dataset) 54 | print('the summary file is saved at {}'.format(os.getcwd())) 55 | with open(fname, 'w') as fout: 56 | print(t_wiki, file=fout) 57 | 58 | 59 | 60 | if __name__ == '__main__': 61 | parser = argparse.ArgumentParser() 62 | parser.add_argument('--dataset', choices={'mnist', 'fashion_mnist'}, default='mnist') 63 | args = parser.parse_args() 64 | gen_summary(args.dataset) 65 | 66 | 67 | -------------------------------------------------------------------------------- /img/RingLoss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/RingLoss.png -------------------------------------------------------------------------------- /img/arcface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/arcface.png -------------------------------------------------------------------------------- /img/e^x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/e^x.png -------------------------------------------------------------------------------- /img/intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/intro.png -------------------------------------------------------------------------------- /img/softmax_feature2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/softmax_feature2.png -------------------------------------------------------------------------------- /img/softmax_normweight_feature2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/softmax_normweight_feature2.png -------------------------------------------------------------------------------- /img/softmax_removebias_feature2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/softmax_removebias_feature2.png -------------------------------------------------------------------------------- /img/softmax_weightdecay_feature2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/img/softmax_weightdecay_feature2.png -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'fashion_mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.1 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'fashion_mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.2 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'fashion_mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.3 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'fashion_mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 1 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 10 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 20 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale5/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 5 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 50 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 1 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 10 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 20 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 5 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 50 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.01 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | weight_norm = torch.norm(self.pred.weight, dim=1) 53 | x = x / weight_norm 54 | 55 | return x 56 | 57 | class FeatureExtractor(torch.nn.Module): 58 | 59 | def __init__(self, submodule, extracted_layers): 60 | super(FeatureExtractor, self).__init__() 61 | self.submodule = submodule 62 | self.extracted_layers = extracted_layers 63 | 64 | def forward(self, x): 65 | outputs = {} 66 | for name,module in self.submodule._modules.items(): 67 | if name is "feature": x = x.view(x.size(0), -1) 68 | x = module(x) 69 | if name in self.extracted_layers: 70 | outputs[name] = x 71 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.01 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | # weight_norm = torch.norm(self.pred.weight, dim=1) 59 | # x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | # weight_norm = torch.norm(self.pred.weight, dim=1) 59 | # x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | # weight_norm = torch.norm(self.pred.weight, dim=1) 59 | # x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/fashion_mnist.softmax.weight_decay1e-3.feature2/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'fashion_mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | 53 | return x 54 | 55 | class FeatureExtractor(torch.nn.Module): 56 | 57 | def __init__(self, submodule, extracted_layers): 58 | super(FeatureExtractor, self).__init__() 59 | self.submodule = submodule 60 | self.extracted_layers = extracted_layers 61 | 62 | def forward(self, x): 63 | outputs = {} 64 | for name,module in self.submodule._modules.items(): 65 | if name is "feature": x = x.view(x.size(0), -1) 66 | x = module(x) 67 | if name in self.extracted_layers: 68 | outputs[name] = x 69 | return outputs -------------------------------------------------------------------------------- /src/misc.py: -------------------------------------------------------------------------------- 1 | import os 2 | from contextlib import contextmanager 3 | from pathlib import Path 4 | 5 | def ensure_dir(*paths, erase=False): 6 | import shutil 7 | for path in paths: 8 | if os.path.exists(path) and erase: 9 | print('Removing old folder {}'.format(path)) 10 | try: 11 | shutil.rmtree(path) 12 | except Exception as e: 13 | print('Try to use sudo') 14 | import traceback 15 | traceback.print_exc() 16 | os.system('sudo rm -rf {}'.format(path)) 17 | 18 | if not os.path.exists(path): 19 | print('Creating folder {}'.format(path)) 20 | try: 21 | os.makedirs(path, exist_ok=True) 22 | except Exception as e: 23 | print('Try to use sudo') 24 | import traceback 25 | traceback.print_exc() 26 | os.system('sudo mkdir -p {}'.format(path)) 27 | 28 | @contextmanager 29 | def change_dir(dirpath): 30 | dirpath = str(dirpath) 31 | cwd = os.getcwd() 32 | try: 33 | os.chdir(dirpath) 34 | yield 35 | finally: 36 | os.chdir(cwd) 37 | 38 | 39 | def make_symlink_if_not_exists(src, dst, overwrite=False): 40 | src, dst = Path(src), Path(dst) 41 | 42 | if overwrite and dst.is_symlink(): 43 | dst.unlink() 44 | 45 | if (not dst.exists()) and (not dst.is_symlink()): 46 | dst.symlink_to(src) 47 | else: 48 | raise OSError("symbolic link {} already exists!".format(dst)) -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.01 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.1 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.2 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0.3 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from IPython import embed 3 | 4 | # config 5 | data_set = 'mnist' 6 | n_epochs = 40 7 | n_feature = 2 8 | weight_decay = 1e-3 9 | scale = 10 10 | margin = 0 11 | 12 | 13 | class Model(torch.nn.Module): 14 | 15 | def __init__(self, feature): 16 | super(Model, self).__init__() 17 | self.backbone = torch.nn.Sequential( 18 | 19 | # 28 - 14 20 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 21 | 22 | # 14 - 7 23 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 24 | torch.nn.ReLU(), 25 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 26 | 27 | # 7 - 3 28 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 29 | torch.nn.ReLU(), 30 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 31 | torch.nn.ReLU(), 32 | 33 | # 3 - 1 34 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 35 | 36 | ) 37 | 38 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 39 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 40 | 41 | # for m in self.modules(): 42 | # if isinstance(m, torch.nn.Conv2d): 43 | # torch.nn.init.xavier_normal_(m.weight) 44 | # elif isinstance(m, torch.nn.BatchNorm2d): 45 | # torch.nn.init.constant_(m.weight, 1) 46 | # torch.nn.init.constant_(m.bias, 0) 47 | 48 | 49 | def forward(self, x): 50 | 51 | x = self.backbone(x) 52 | x = x.view(x.size(0), -1) 53 | x = self.feature(x) 54 | 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) 56 | x = x / feature_norm 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x 62 | 63 | def am_softmax(x, y, scale=scale, margin=margin): 64 | idx = torch.eye(10)[y].to(x.device) 65 | x = scale * (x - idx * margin) 66 | return x 67 | 68 | class FeatureExtractor(torch.nn.Module): 69 | 70 | def __init__(self, submodule, extracted_layers): 71 | super(FeatureExtractor, self).__init__() 72 | self.submodule = submodule 73 | self.extracted_layers = extracted_layers 74 | 75 | def forward(self, x): 76 | outputs = {} 77 | for name,module in self.submodule._modules.items(): 78 | if name is "feature": x = x.view(x.size(0), -1) 79 | x = module(x) 80 | if name in self.extracted_layers: 81 | outputs[name] = x 82 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import numpy as np 3 | from IPython import embed 4 | 5 | # config 6 | data_set = 'mnist' 7 | n_epochs = 40 8 | n_feature = 2 9 | weight_decay = 1e-3 10 | scale = 10 11 | margin = 0 # 角度 12 | 13 | 14 | class Model(torch.nn.Module): 15 | 16 | def __init__(self, feature): 17 | super(Model, self).__init__() 18 | self.backbone = torch.nn.Sequential( 19 | 20 | # 28 - 14 21 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 22 | 23 | # 14 - 7 24 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 25 | torch.nn.ReLU(), 26 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 27 | 28 | # 7 - 3 29 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 30 | torch.nn.ReLU(), 31 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 32 | torch.nn.ReLU(), 33 | 34 | # 3 - 1 35 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 36 | 37 | ) 38 | 39 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 40 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 41 | 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | 56 | feature_norm = torch.norm(x, dim=1, keepdim=True) 57 | x = x / feature_norm 58 | x = self.pred(x) 59 | weight_norm = torch.norm(self.pred.weight, dim=1) 60 | x = x / weight_norm 61 | 62 | return x 63 | 64 | def arc_face(x, y, scale=scale, margin=margin): 65 | margin = margin / 180 * np.pi 66 | 67 | x = x.clamp(min=-1+1e-6, max=1-1e-6) 68 | x = torch.acos(x) 69 | idx = torch.eye(10)[y].to(x.device) 70 | x = scale * torch.cos(x + idx * margin) 71 | return x 72 | 73 | class FeatureExtractor(torch.nn.Module): 74 | 75 | def __init__(self, submodule, extracted_layers): 76 | super(FeatureExtractor, self).__init__() 77 | self.submodule = submodule 78 | self.extracted_layers = extracted_layers 79 | 80 | def forward(self, x): 81 | outputs = {} 82 | for name,module in self.submodule._modules.items(): 83 | if name is "feature": x = x.view(x.size(0), -1) 84 | x = module(x) 85 | if name in self.extracted_layers: 86 | outputs[name] = x 87 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 1 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 10 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 20 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 5 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 50 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | weight_norm = torch.norm(self.pred.weight, dim=1) 57 | x = x / weight_norm 58 | 59 | return x 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 1 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 10 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 20 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 5 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | scale = 50 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | 53 | feature_norm = torch.norm(x, dim=1, keepdim=True) 54 | x = scale * x / feature_norm 55 | x = self.pred(x) 56 | 57 | return x 58 | 59 | class FeatureExtractor(torch.nn.Module): 60 | 61 | def __init__(self, submodule, extracted_layers): 62 | super(FeatureExtractor, self).__init__() 63 | self.submodule = submodule 64 | self.extracted_layers = extracted_layers 65 | 66 | def forward(self, x): 67 | outputs = {} 68 | for name,module in self.submodule._modules.items(): 69 | if name is "feature": x = x.view(x.size(0), -1) 70 | x = module(x) 71 | if name in self.extracted_layers: 72 | outputs[name] = x 73 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.01 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=True) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | weight_norm = torch.norm(self.pred.weight, dim=1) 59 | x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.normweight/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | weight_norm = torch.norm(self.pred.weight, dim=1) 53 | x = x / weight_norm 54 | 55 | return x 56 | 57 | class FeatureExtractor(torch.nn.Module): 58 | 59 | def __init__(self, submodule, extracted_layers): 60 | super(FeatureExtractor, self).__init__() 61 | self.submodule = submodule 62 | self.extracted_layers = extracted_layers 63 | 64 | def forward(self, x): 65 | outputs = {} 66 | for name,module in self.submodule._modules.items(): 67 | if name is "feature": x = x.view(x.size(0), -1) 68 | x = module(x) 69 | if name in self.extracted_layers: 70 | outputs[name] = x 71 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.01 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | 59 | return x, feature_norm, self.R 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 0.1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | 59 | return x, feature_norm, self.R 60 | 61 | class FeatureExtractor(torch.nn.Module): 62 | 63 | def __init__(self, submodule, extracted_layers): 64 | super(FeatureExtractor, self).__init__() 65 | self.submodule = submodule 66 | self.extracted_layers = extracted_layers 67 | 68 | def forward(self, x): 69 | outputs = {} 70 | for name,module in self.submodule._modules.items(): 71 | if name is "feature": x = x.view(x.size(0), -1) 72 | x = module(x) 73 | if name in self.extracted_layers: 74 | outputs[name] = x 75 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | lamb = 1 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 -> 14 18 | torch.nn.Conv2d(1, 16, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 -> 7 21 | torch.nn.Conv2d(16, 32, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 -> 3 26 | torch.nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 -> 1 32 | torch.nn.AvgPool2d(stride=3, kernel_size=3), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(64, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | self.R = torch.nn.Parameter(torch.Tensor(1), requires_grad=True) 40 | 41 | self.R.data.fill_(1) 42 | # for m in self.modules(): 43 | # if isinstance(m, torch.nn.Conv2d): 44 | # torch.nn.init.xavier_normal_(m.weight) 45 | # elif isinstance(m, torch.nn.BatchNorm2d): 46 | # torch.nn.init.constant_(m.weight, 1) 47 | # torch.nn.init.constant_(m.bias, 0) 48 | 49 | 50 | def forward(self, x): 51 | 52 | x = self.backbone(x) 53 | x = x.view(x.size(0), -1) 54 | x = self.feature(x) 55 | feature_norm = torch.norm(x, dim=1, keepdim=True) + 1e-6 56 | 57 | x = self.pred(x) 58 | # weight_norm = torch.norm(self.pred.weight, dim=1) 59 | # x = x / weight_norm 60 | 61 | return x, feature_norm, self.R 62 | 63 | class FeatureExtractor(torch.nn.Module): 64 | 65 | def __init__(self, submodule, extracted_layers): 66 | super(FeatureExtractor, self).__init__() 67 | self.submodule = submodule 68 | self.extracted_layers = extracted_layers 69 | 70 | def forward(self, x): 71 | outputs = {} 72 | for name,module in self.submodule._modules.items(): 73 | if name is "feature": x = x.view(x.size(0), -1) 74 | x = module(x) 75 | if name in self.extracted_layers: 76 | outputs[name] = x 77 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2.withbias/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=True) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | 53 | return x 54 | 55 | class FeatureExtractor(torch.nn.Module): 56 | 57 | def __init__(self, submodule, extracted_layers): 58 | super(FeatureExtractor, self).__init__() 59 | self.submodule = submodule 60 | self.extracted_layers = extracted_layers 61 | 62 | def forward(self, x): 63 | outputs = {} 64 | for name,module in self.submodule._modules.items(): 65 | if name is "feature": x = x.view(x.size(0), -1) 66 | x = module(x) 67 | if name in self.extracted_layers: 68 | outputs[name] = x 69 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-3.feature2/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-3 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | 53 | return x 54 | 55 | class FeatureExtractor(torch.nn.Module): 56 | 57 | def __init__(self, submodule, extracted_layers): 58 | super(FeatureExtractor, self).__init__() 59 | self.submodule = submodule 60 | self.extracted_layers = extracted_layers 61 | 62 | def forward(self, x): 63 | outputs = {} 64 | for name,module in self.submodule._modules.items(): 65 | if name is "feature": x = x.view(x.size(0), -1) 66 | x = module(x) 67 | if name in self.extracted_layers: 68 | outputs[name] = x 69 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-5 8 | learning_rate = 1e-4 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=True) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | x = self.pred(x) 53 | 54 | return x 55 | 56 | class FeatureExtractor(torch.nn.Module): 57 | 58 | def __init__(self, submodule, extracted_layers): 59 | super(FeatureExtractor, self).__init__() 60 | self.submodule = submodule 61 | self.extracted_layers = extracted_layers 62 | 63 | def forward(self, x): 64 | outputs = {} 65 | for name,module in self.submodule._modules.items(): 66 | if name is "feature": x = x.view(x.size(0), -1) 67 | x = module(x) 68 | if name in self.extracted_layers: 69 | outputs[name] = x 70 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-5 8 | learning_rate = 1e-4 9 | 10 | 11 | class Model(torch.nn.Module): 12 | 13 | def __init__(self, feature): 14 | super(Model, self).__init__() 15 | self.backbone = torch.nn.Sequential( 16 | 17 | # 28 - 14 18 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 19 | 20 | # 14 - 7 21 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 22 | torch.nn.ReLU(), 23 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 24 | 25 | # 7 - 3 26 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 27 | torch.nn.ReLU(), 28 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 29 | torch.nn.ReLU(), 30 | 31 | # 3 - 1 32 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 33 | 34 | ) 35 | 36 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 37 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 38 | 39 | # for m in self.modules(): 40 | # if isinstance(m, torch.nn.Conv2d): 41 | # torch.nn.init.xavier_normal_(m.weight) 42 | # elif isinstance(m, torch.nn.BatchNorm2d): 43 | # torch.nn.init.constant_(m.weight, 1) 44 | # torch.nn.init.constant_(m.bias, 0) 45 | 46 | 47 | def forward(self, x): 48 | 49 | x = self.backbone(x) 50 | x = x.view(x.size(0), -1) 51 | x = self.feature(x) 52 | x = self.pred(x) 53 | 54 | return x 55 | 56 | class FeatureExtractor(torch.nn.Module): 57 | 58 | def __init__(self, submodule, extracted_layers): 59 | super(FeatureExtractor, self).__init__() 60 | self.submodule = submodule 61 | self.extracted_layers = extracted_layers 62 | 63 | def forward(self, x): 64 | outputs = {} 65 | for name,module in self.submodule._modules.items(): 66 | if name is "feature": x = x.view(x.size(0), -1) 67 | x = module(x) 68 | if name in self.extracted_layers: 69 | outputs[name] = x 70 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-5.feature2.normweight/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-5 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | weight_norm = torch.norm(self.pred.weight, dim=1) 53 | x = x / weight_norm 54 | 55 | return x 56 | 57 | class FeatureExtractor(torch.nn.Module): 58 | 59 | def __init__(self, submodule, extracted_layers): 60 | super(FeatureExtractor, self).__init__() 61 | self.submodule = submodule 62 | self.extracted_layers = extracted_layers 63 | 64 | def forward(self, x): 65 | outputs = {} 66 | for name,module in self.submodule._modules.items(): 67 | if name is "feature": x = x.view(x.size(0), -1) 68 | x = module(x) 69 | if name in self.extracted_layers: 70 | outputs[name] = x 71 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-5.feature2.withbias/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-5 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=True) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | 53 | return x 54 | 55 | class FeatureExtractor(torch.nn.Module): 56 | 57 | def __init__(self, submodule, extracted_layers): 58 | super(FeatureExtractor, self).__init__() 59 | self.submodule = submodule 60 | self.extracted_layers = extracted_layers 61 | 62 | def forward(self, x): 63 | outputs = {} 64 | for name,module in self.submodule._modules.items(): 65 | if name is "feature": x = x.view(x.size(0), -1) 66 | x = module(x) 67 | if name in self.extracted_layers: 68 | outputs[name] = x 69 | return outputs -------------------------------------------------------------------------------- /src/mnist.softmax.weight_decay1e-5.feature2/config.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # config 4 | data_set = 'mnist' 5 | n_epochs = 40 6 | n_feature = 2 7 | weight_decay = 1e-5 8 | 9 | 10 | class Model(torch.nn.Module): 11 | 12 | def __init__(self, feature): 13 | super(Model, self).__init__() 14 | self.backbone = torch.nn.Sequential( 15 | 16 | # 28 - 14 17 | torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3), 18 | 19 | # 14 - 7 20 | torch.nn.Conv2d(64, 128, kernel_size=5, stride=1, padding=2), 21 | torch.nn.ReLU(), 22 | torch.nn.MaxPool2d(stride=2, kernel_size=2), 23 | 24 | # 7 - 3 25 | torch.nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1), 26 | torch.nn.ReLU(), 27 | torch.nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1), 28 | torch.nn.ReLU(), 29 | 30 | # 3 - 1 31 | torch.nn.AvgPool2d(stride=4, kernel_size=4), 32 | 33 | ) 34 | 35 | self.feature = torch.nn.Linear(512, feature) # Feature extract layer 36 | self.pred = torch.nn.Linear(feature, 10, bias=False) # Classification layer 37 | 38 | # for m in self.modules(): 39 | # if isinstance(m, torch.nn.Conv2d): 40 | # torch.nn.init.xavier_normal_(m.weight) 41 | # elif isinstance(m, torch.nn.BatchNorm2d): 42 | # torch.nn.init.constant_(m.weight, 1) 43 | # torch.nn.init.constant_(m.bias, 0) 44 | 45 | 46 | def forward(self, x): 47 | 48 | x = self.backbone(x) 49 | x = x.view(x.size(0), -1) 50 | x = self.feature(x) 51 | x = self.pred(x) 52 | 53 | return x 54 | 55 | class FeatureExtractor(torch.nn.Module): 56 | 57 | def __init__(self, submodule, extracted_layers): 58 | super(FeatureExtractor, self).__init__() 59 | self.submodule = submodule 60 | self.extracted_layers = extracted_layers 61 | 62 | def forward(self, x): 63 | outputs = {} 64 | for name,module in self.submodule._modules.items(): 65 | if name is "feature": x = x.view(x.size(0), -1) 66 | x = module(x) 67 | if name in self.extracted_layers: 68 | outputs[name] = x 69 | return outputs -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale10/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale20/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normface.scale50/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/R.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/R.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.normweight/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/R.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/R.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/R.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2.ringloss.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/fashion_mnist.softmax.weight_decay1e-3.feature2/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/fashion_mnist.softmax.weight_decay1e-3.feature2/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.01/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.2/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0.3/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.amsoftmax.scale10.margin0/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin0/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin10/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin20/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.arcface.scale10.margin30/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale10/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale20/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale5/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normface.scale50/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale10/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale20/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale5/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normfeature.scale50/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.01/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1.withbias/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.0.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight.ringloss.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.normweight/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.normweight/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.01/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.0.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/R.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.ringloss.1/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.withbias/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.withbias/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.withbias/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.withbias/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2.withbias/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2.withbias/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-3.feature2/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-3.feature2/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4.withbias/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.lr.1e-4/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.normweight/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.normweight/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.normweight/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.normweight/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.normweight/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.normweight/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.withbias/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.withbias/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.withbias/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.withbias/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2.withbias/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2.withbias/feature-best-accuracy.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2/curve/curve-epoch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2/curve/curve-epoch.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2/curve/curve-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2/curve/curve-step.png -------------------------------------------------------------------------------- /train_log/mnist.softmax.weight_decay1e-5.feature2/feature-best-accuracy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwy927/softmax-based-loss/1cc229303a48d2295ceda2514ac2e5ad3d1050f1/train_log/mnist.softmax.weight_decay1e-5.feature2/feature-best-accuracy.png -------------------------------------------------------------------------------- /view_data.py: -------------------------------------------------------------------------------- 1 | import matplotlib 2 | matplotlib.use('Agg') 3 | import torchvision 4 | import matplotlib.pyplot as plt 5 | import sys 6 | from src.common import load_dataset 7 | 8 | def view_data(dataset): 9 | data_loader_train, data_loader_test, data_train, data_test = load_dataset(dataset, 300) 10 | 11 | images, labels = next(iter(data_loader_train)) 12 | plt.figure(1, figsize=(8, 20)) 13 | for i in range(10): 14 | plt.subplot(10, 1, i+1) 15 | image = images[labels == i][:20, :, :] 16 | img = torchvision.utils.make_grid(image, nrow=10) 17 | img = img.numpy().transpose(1, 2, 0) 18 | std = [0.5, 0.5, 0.5] 19 | mean = [0.5, 0.5, 0.5] 20 | img = img * std + mean 21 | plt.axis('off') 22 | plt.imshow(img) 23 | plt.title(i) 24 | print('saving file in data/{}-train.png'.format(dataset)) 25 | plt.savefig('data/{}-train.png'.format(dataset)) 26 | plt.clf() 27 | 28 | images, labels = next(iter(data_loader_test)) 29 | plt.figure(1, figsize=(8, 20)) 30 | for i in range(10): 31 | plt.subplot(10, 1, i + 1) 32 | image = images[labels == i][:20, :, :] 33 | img = torchvision.utils.make_grid(image, nrow=10) 34 | img = img.numpy().transpose(1, 2, 0) 35 | std = [0.5, 0.5, 0.5] 36 | mean = [0.5, 0.5, 0.5] 37 | img = img * std + mean 38 | plt.axis('off') 39 | plt.imshow(img) 40 | plt.title(i) 41 | print('saving file in data/{}-train.png'.format(dataset)) 42 | plt.savefig('data/{}-test.png'.format(dataset)) 43 | plt.clf() 44 | plt.close('all') 45 | 46 | 47 | if __name__ == '__main__': 48 | dataset = sys.argv[1] 49 | assert dataset in ['mnist', 'fashion_mnist'] 50 | view_data(dataset) --------------------------------------------------------------------------------