美文网首页
tensorboardx--scalar

tensorboardx--scalar

作者: ad丶leo | 来源:发表于2019-02-13 13:08 被阅读0次

    train.py

    from tensorboardX import SummaryWriter 
    from opts import parser                                                         
    args=parser.parse_args()                                                        
    model_name=args.model_name  
    a=datetime.datetime.now()                                                       
    b=datetime.datetime.strftime(a,'-%Y-%m-%d-%H-%M-%S')                            
    n_model_name=model_name+b   
    writer = SummaryWriter('runs/'+model_name+'/'+n_model_name)   
    writer.add_scalar('data/trainloss', epoch_loss, epoch)                                                                                
    writer.add_scalar('data/trainacc', epoch_acc, epoch)                                                                        
    writer.add_scalar('data/valloss', epoch_loss, epoch)            
    writer.add_scalar('data/valacc', epoch_acc, epoch)
    writer.export_scalars_to_json("./all_scalars.json")                         
    writer.close()
    

    opts.py

     import argparse                                                                                                                                       
    parser = argparse.ArgumentParser(description="PyTorch implementation of Temporal Segment Networks")
    parser.add_argument('--model_name',type=str)  
    

    watch

    tensorboard --logdir runs --port 66

    相关文章

      网友评论

          本文标题:tensorboardx--scalar

          本文链接:https://www.haomeiwen.com/subject/fboreqtx.html