Skip to content

Instantly share code, notes, and snippets.

View xx025's full-sized avatar
🎯
Focusing

Rycbar123 xx025

🎯
Focusing
View GitHub Profile
@xx025
xx025 / compute_mean_std.py
Last active September 24, 2023 04:24
计算数据集的均值和方差
import json
import os
import torch
from torchvision.datasets import ImageFolder
from torchvision.transforms import ToTensor, PILToTensor
from tqdm import tqdm
def main(data_path, save_name, out_dir='./', is_to01=False):
import json
import os
def set_nested_dict_value(d, keys, value):
d_next = d
for key in keys:
if '_dirs' not in d_next:
d_next['_dirs'] = dict()
if key not in d_next['_dirs']: