我尝试使用 TensorFlow Probability 运行模型。
但是当我运行它时,我收到以下错误:
**ImportError: This version of TensorFlow Probability requires TensorFlow version >= 2.3; Detected an installation of version 2.0.0-beta1. Please upgrade TensorFlow to proceed.**<br>
Run Code Online (Sandbox Code Playgroud)
我无法安装 TensorFlow 2.3,因为它说没有匹配项。
我已经安装了这些库。
张量流(2.0.0b1)
张量流估计器(1.14.0)
张量流张量板(1.5.1)
tfp-nightly(0.12.0.dev20200817)
有什么建议如何修复它吗?
提前致谢
我main.py使用 pyinstaller成功转换了脚本。但是,在执行.exe文件时会抛出以下错误。
MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them will be removed two minor releases later.
exec(bytecode, module.__dict__)
Traceback (most recent call last):
File "main.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\users\XXXX\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "matplotlib\__init__.py", …Run Code Online (Sandbox Code Playgroud) 我试图根据轮廓的到达对轮廓进行排序,left-to-right就像top-to-bottom你写任何东西一样。从,top然后left,以相应的情况为准。
到目前为止,这就是我所取得的成就和方式:
def get_contour_precedence(contour, cols):
tolerance_factor = 61
origin = cv2.boundingRect(contour)
return ((origin[1] // tolerance_factor) * tolerance_factor) * cols + origin[0]
image = cv2.imread("C:/Users/XXXX/PycharmProjects/OCR/raw_dataset/23.png", 0)
ret, thresh1 = cv2.threshold(image, 130, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)
contours, h = cv2.findContours(thresh1.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# perform edge detection, find contours in the edge map, and sort the
# resulting contours from left-to-right
contours.sort(key=lambda x: get_contour_precedence(x, thresh1.shape[1]))
# initialize the list of contour bounding boxes and associated …Run Code Online (Sandbox Code Playgroud) 我正在尝试显示 Imagedatagenerator.flow() 生成的图像,但我无法这样做。
我使用单个图像并将其传递给 .flow(img_path) 来生成增强图像,直到总数符合我们的要求:
total = 0
for image in imageGen:
total += 1
if total == 10:
break
Run Code Online (Sandbox Code Playgroud)
.flow()
imageGen = aug.flow(image_path, batch_size=1,
save_to_dir="/path/to/save_dir",
save_prefix="", save_format='png')
Run Code Online (Sandbox Code Playgroud)
如何接收在循环中生成的图像,以便我可以在运行时显示它?
我有三个清单:
包含键的列表是:
keys = ['testname', 'output']
Run Code Online (Sandbox Code Playgroud)
包含值的列表是:
value1 = ['pizza', 'dog', 'lion']
value2 = ['12.3', '356', '45.6']
Run Code Online (Sandbox Code Playgroud)
我想要的输出是:
{
"Labresult":[
{ 'testname': 'pizza',
'output': '12.3',
},
{ 'testname': 'dog',
'output': '356,'
},
{ 'testname': 'lion',
'output': '45.6',
}]
}
Run Code Online (Sandbox Code Playgroud)
我试过的:
dict(zip(key, zip(value1,value2)))
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用不同的字体为 OCR 生成数据集,但是在某个 for 循环中,迭代给我和错误Typeerror: int object is not iterable.
我已经搜索了足够多的结论,StackOverFlow 上的大多数答案都建议使用我的 for 循环中的范围,包括 (len ) 但我不确定我是否遵循这一点。
功能如下:
def gen_rand_string_data(data_count,
min_char_count=3,
max_char_count=8,
max_char=16,
x_pos='side',
img_size=(32, 256, 1),
font=cv2.FONT_HERSHEY_SIMPLEX,
font_scale=np.arange(0.7, 1, 0.1),
thickness=range(1, 3, 1)):
'''
random string data generation
'''
start_time = dt.datetime.now()
images = []
labels = []
color = (255, 255, 255)
count = 0
char_list = list(string.ascii_letters) \
+ list(string.digits) \
+ list(' ')
while (1):
for fs in font_scale:
for thick in thickness:
for f …Run Code Online (Sandbox Code Playgroud) python ×4
python-3.x ×3
python-3.7 ×2
tensorflow ×2
contour ×1
dictionary ×1
keras ×1
list ×1
matplotlib ×1
opencv ×1
pyinstaller ×1