-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
49 lines (44 loc) · 1.75 KB
/
Copy pathtest.py
File metadata and controls
49 lines (44 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# import string
# import random
#
# from captcha.image import ImageCaptcha
#
#
# chars = string.digits + string.ascii_letters
# image = ImageCaptcha()
#
# for _ in range(5500):
# s = "".join(random.choices(chars, k=6))
# print(s)
# path = f'./captcha2/dataset/validation/{s}.png'
# image.write(s, path)
# import numpy
# import torch
# from matplotlib import pyplot
#
# a = [[10], [20], [30]]
# b = [[100], [200], [300]]
# # a = numpy.array(a)
# # print(a.flatten())
# # a = torch.tensor(a)
# # b = torch.tensor(b)
# #
# # pyplot.plot(a.detach().numpy(), label='1')
# # pyplot.plot(b.detach().numpy(), label='2')
# pyplot.plot(a, label='1')
# pyplot.plot(b, label='2')
# pyplot.legend()
# pyplot.show()
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.patches as patches
image = Image.open('./课程设计/data/test/1151_jpg.rf.17b666e0803c2fcd6b5b292fadf7afd5.jpg')
fig, ax = plt.subplots(1, figsize=(12, 9))
ax.imshow(image) # 转换为 HWC 格式以便显示
rect = patches.Rectangle((305, 275), 56, 81, linewidth=2, edgecolor='r', facecolor='none')
ax.add_patch(rect)
plt.show()
# # a = [0.6013986013986014, 0.6410256410256411, 0.7505827505827506, 0.7645687645687645, 0.7435897435897436, 0.7855477855477856, 0.8111888111888111, 0.8484848484848485, 0.8135198135198135, 0.8111888111888111] # noqa
# a = [0.5291375291375291, 0.668997668997669, 0.7016317016317016, 0.7808857808857809, 0.7948717948717948, 0.8438228438228438, 0.8041958041958042, 0.8275058275058275, 0.8298368298368298, 0.8438228438228438, 0.8181818181818182, 0.8205128205128205, 0.8321678321678322, 0.8275058275058275, 0.8578088578088578, 0.8111888111888111, 0.8391608391608392, 0.8578088578088578, 0.8484848484848485, 0.8275058275058275] # noqa
# pyplot.plot(a)
# pyplot.show()