This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nfft.nfft import Plan | |
import nibabel as nib | |
import numpy as np | |
import time | |
# Load image | |
img = nib.load("./merge_cartesian_2D_0cycles.nii.gz").get_data() | |
width = img.shape[1] | |
# Zeropadding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import struct | |
def read_hog(filename, batch_size=5000): | |
""" | |
Read HoG features file created by OpenFace. | |
For each frame, OpenFace extracts 12 * 12 * 31 HoG features, i.e., num_features = 4464. These features are stored in row-major order. | |
:param filename: path to .hog file created by OpenFace | |
:param batch_size: how many rows to read at a time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from PIL import Image | |
import numpy as np | |
from glob import glob | |
import os | |
from tqdm import tqdm | |
from diffusers import DiffusionPipeline | |
import torch | |
import torchvision.transforms as T |