MCPcopy
hub / github.com/JaidedAI/EasyOCR / copyStateDict

Function copyStateDict

easyocr/detection.py:13–22  ·  view source on GitHub ↗
(state_dict)

Source from the content-addressed store, hash-verified

11from .craft import CRAFT
12
13def copyStateDict(state_dict):
14 if list(state_dict.keys())[0].startswith("module"):
15 start_idx = 1
16 else:
17 start_idx = 0
18 new_state_dict = OrderedDict()
19 for k, v in state_dict.items():
20 name = ".".join(k.split(".")[start_idx:])
21 new_state_dict[name] = v
22 return new_state_dict
23
24def test_net(canvas_size, mag_ratio, net, image, text_threshold, link_threshold, low_text, poly, device, estimate_num_chars=False):
25 if isinstance(image, np.ndarray) and len(image.shape) == 4: # image is batch of np arrays

Callers 1

get_detectorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…