<jupyter_start><jupyter_text>Test deepFEPE dataloader- Unit test<jupyter_code>import os
import sys
# add your module path
module_path = os.path.abspath(os.path.join('..')) # '.'
if module_path not in sys.path:
    sys.path.append(module_path)
# change your base path
os.chdir('../') # '../'
print(os.getcwd())
%load_ext autoreload
%autoreload 2
import torch
import logging
import yaml
from deepFEPE.utils.loader import dataLoader
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
logging.info('train on device: %s', device)
config_file = 'deepFEPE/configs/kitti_corr_baseline.yaml' ## kitti
config_file = 'deepFEPE/configs/apollo_train_corr_baseline.yaml' ## apollo
with open(config_file, 'r') as f:
    config = yaml.load(f)

val = 'val' 
data = dataLoader(config, dataset='kitti_odo_corr', val=val, warp_input=True, val_shuffle=False)
train_loader, val_loader = data['train_loader'], data['val_loader']
logging.info('+++[Dataset]+++ train split size %d in %d batches, val split size %d in %d batches'%\
    (len(train_loader)*config['data']['batch_size'], len(train_loader), len(val_loader)*config['data']['batch_size'], len(val_loader)))<jupyter_output>2020-07-15 15:50:37 meng-Alienware root[7899] INFO train on device: cuda
/home/yoyee/miniconda3/envs/py36-deepsfm/lib/python3.6/site-packages/ipykernel_launcher.py:6: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  
2020-07-15 15:50:37 meng-Alienware root[7899] INFO ===[Data]=== Resizing to [H600, W800]
2020-07-15 15:50:37 meng-Alienware root[7899] INFO use size: [600, 800] for vertual points
2020-07-15 15:50:37 meng-Alienware root[7899] INFO Crawling folders for 117 frames...
  0%|          | 0/1 [00:00<?, ?it/s]<jupyter_text>Visualize one sample<jupyter_code>for i, sample in enumerate(train_loader):
    if i > 1: break
list(sample)
import matplotlib.pyplot as plt
import numpy as np
def check_sample(sample, idx=0):
    print(f"relative_scene_poses: {sample['relative_scene_poses'][0][idx]})")
    print(f"K: {sample['K'][idx]})")
    print(f"imgs: {sample['imgs'][0][idx].shape})")
    plt.imshow(sample['imgs'][0][idx].numpy().astype(np.int32))
    plt.show()
#     plt.imshow(sample['imgs'][1]) 
#     plt.show()
check_sample(sample)<jupyter_output>relative_scene_poses: tensor([[1., 0., 0., 0.],
        [0., 1., 0., 0.],
        [0., 0., 1., 0.]]))
K: tensor([[544.8104,   0.0000, 398.6378],
        [  0.0000, 510.5260, 299.9966],
        [  0.0000,   0.0000,   1.0000]]))
imgs: torch.Size([600, 800, 3]))
{'fraction_non_alphanumeric': 0.17183314198239572, 'fraction_numerical': 0.06926903941829315, 'mean_word_length': 4.847874720357942, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '410724', 'license': 'MIT', 'n_tokens_mistral': 1111, 'n_tokens_neox': 983, 'n_words': 218, 'path': 'notebooks/test_deepFEPE_dataset.ipynb', 'repo_name': 'KuangHaofei/pytorch-deepFEPE', 'size': '2613'}