dewarpNet矫正扭曲

This commit is contained in:
2024-08-12 08:38:17 +08:00
parent 6fd5c059c2
commit 4fabb1a1e9
6 changed files with 469 additions and 0 deletions

17
dewarp/utils.py Normal file
View File

@@ -0,0 +1,17 @@
'''
Misc Utility functions
'''
from collections import OrderedDict
def convert_state_dict(state_dict):
"""Converts a state dict saved from a dataParallel module to normal
module state_dict inplace
:param state_dict is the loaded DataParallel model_state
"""
new_state_dict = OrderedDict()
for k, v in state_dict.items():
name = k[7:] # remove `module.`
new_state_dict[name] = v
return new_state_dict