서민정

feat: 최종 업로드

......@@ -36,10 +36,6 @@ parser.add_argument("--weight-decay", "--wd", default=1e-4, type=float, help="We
parser.add_argument('--pretrained', default='', type=str, help='path to pretrained model (default: none)')
parser.add_argument("--gpus", default="0", type=str, help="gpu ids (default: 0)")
total_loss_for_plot = list()
total_pnsr = list()
def main():
global opt, model
opt = parser.parse_args()
......@@ -141,17 +137,14 @@ def train(training_data_loader, optimizer, model, criterion, epoch):
optimizer.step()
epoch_loss = total_loss / len(training_data_loader)
total_loss_for_plot.append(epoch_loss)
psnr = PSNR(epoch_loss)
total_pnsr.append(psnr)
print("===> Epoch[{}]: loss : {:.10f} ,PSNR : {:.10f}".format(epoch, epoch_loss, psnr))
# if iteration%100 == 0:
# print("===> Epoch[{}]({}/{}): Loss: {:.10f}".format(epoch, iteration, len(training_data_loader), loss.item()))
def save_checkpoint(model, epoch, optimizer):
model_out_path = "checkpoint/" + "model_epoch_{}_{}.pth".format(epoch, opt.featureType)
state = {"epoch": epoch ,"model": model, "model_state_dict":model.state_dict(), "optimizer_state_dict":optimizer.state_dict(),
"loss": total_loss_for_plot, "psnr":total_pnsr}
state = {"epoch": epoch ,"model": model, "model_state_dict":model.state_dict(), "optimizer_state_dict":optimizer.state_dict()}
if not os.path.exists("checkpoint/"):
os.makedirs("checkpoint/")
......
No preview for this file type