ABOUT ME

notou10@yonsei.ac.kr

Today
Yesterday
Total
  • matplotlib 그리기
    카테고리 없음 2022. 7. 15. 18:47

    for문 내에서 배치 내 이미지 잘 가져왔나 확인

    -> tensor 받아서 make_grid로 그리기

    for i, (examples) in tqdm(enumerate(loader), total=len(loader)):      
            examples = examples.cuda(device)
            plt.close()
            
            grid = torchvision.utils.make_grid(examples, nrow = 4)
            plt.imshow(grid.permute(1, 2, 0).detach().cpu().numpy())
        
            plt.show()
            plt.savefig('./dfddfdf.png', dpi = 600)
    
            output = model(examples)

     

    correlation 구하고 그리기

    import numpy as np
    import matplotlib.pyplot as plt
    
    style_embedding = np.load("../ffhq_result/style_element.npy")
    shape_embedding = np.load("../ffhq_result/shape_element.npy")
    
    
    coeff = np.corrcoef(shape_embedding, style_embedding)
    
    plt.bar(np.arange(512), style_embedding)
    plt.bar(np.arange(512), -shape_embedding)
    
    plt.savefig("../ffhq_result/shape_style_correlation.png")
    plt.show()
    plt.close()
        
    
    import pdb; pdb.set_trace()
Designed by Tistory.