我是Tensorflow的新手,我正在尝试构建能够对我的图像执行OCR的模型.我必须阅读9个字符(固定在所有图像中),数字和字母.我的模型与此类似
https://matthewearl.github.io/2016/05/06/cnn-anpr/
我的问题是,我是否应该首先针对每个角色训练我的模型,然后在组合角色后获得完整的标签.或者我应该直接在全标签上训练?
我知道我需要传递给模型,图像+相应图像的标签,这些标签的格式是什么,是文本文件,我对该部分有点困惑,所以对传递给模型的标签格式有任何解释会有帮助吗?谢谢,谢谢.
我有net6.0
一个具有最少 api 的项目,我想使用NetwtonsoftJson
而不是内置System.Text.Json
库来进行序列化和反序列化。
目前我有这个配置JsonOptions
并且可以按预期工作
builder.Services.Configure<JsonOptions>(options =>
{
options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
options.SerializerOptions.WriteIndented = true;
options.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
options.SerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
});
Run Code Online (Sandbox Code Playgroud)
如果我尝试更改为Newtonsoft.Json.JsonSerializerSettings
类似下面使用的等效内容,我不会得到相同的行为。相反,它看起来像是使用默认System.Text.Json
配置。
builder.Services.Configure<JsonSerializerSettings>(options =>
{
options.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
options.Converters.Add(
new StringEnumConverter
{
NamingStrategy = new Newtonsoft.Json.Serialization.CamelCaseNamingStrategy()
});
});
Run Code Online (Sandbox Code Playgroud)
我知道net5.0
我可以用这个
services.AddControllers().AddNewtonsoftJson((options) => //options); // OR
services.AddMvc().AddNewtonsoftJson((options) => //options);
Run Code Online (Sandbox Code Playgroud)
但是,如果我在net6.0
项目中像上面那样使用它,那么我就不再使用 MinimalApi 了?
我有包含 div 元素的组件。我希望能够根据该 div 元素的边框颜色禁用/启用对该 div 元素的单击。
想法是有一个方法,该方法将返回应在 div 上绘制的边框颜色,然后如果颜色为“绿色”,则将该 div 的 pointerEvent 设置为“auto”,如果它不是“绿色”,则将 pointerEvent 设置为“none”。然而,当我尝试这样做时,我遇到了奇怪的语法错误,我无法弄清楚为什么会发生这种情况,我认为代码没问题,但 Typescript 中的其他一些配置可能是错误的。我得到的错误如下所示
[ts] 类型 '{pointerEvents: string; 显示:字符串;边框:字符串;高度:字符串;宽度:字符串;左边缘:字符串;}' 不可分配给类型“CSSProperties”。属性“pointerEvents”的类型不兼容。类型“string”不可分配给类型“PointerEventsProperty”。[2322服]第2322服[双线] 新服
我尝试将属性设置为一个值“none”或“auto”,效果很好,但是当我放入条件语句时,它不起作用。我尝试将样式设置为 CSSProperties 类型,但随后出现如下错误:
[ts] 类型“string”不可分配给类型“”-moz-initial”| “继承”| “初始”| “恢复”| “取消设置”| “全部” | “自动”| “填充”| “无” | “画”| “中风”| “可见”| “可见填充” | “可见画”| “可见中风”| 可观察<...>'。[2322服]第2322服[双线] 新服
风格定义:
const divContainerDetailsStyle ={
pointerEvents: `${this.whatColorToDraw('container') == 'green' ? 'auto' as PointerEventsProperty : 'none' as PointerEventsProperty }`,
display: 'inline-block',
border: `${this.whatColorToDraw('container') == 'green' ? '5px' : '1px'} solid ${this.whatColorToDraw('container')}`,
height: '20%', …
Run Code Online (Sandbox Code Playgroud) 我有一个 React+Typescript Web 应用程序,我正在尝试在画布上绘制矩形。我想使用 React hooks 并尽可能避免使用类。
预期结果是当鼠标按下并移动时,能够在画布内绘制所需数量的矩形。我还想稍后扩展它以允许拖动、调整大小和不同的形状。
目前我可以绘制矩形,但是当鼠标移动时,上下文会不断添加矩形,而不是更新原始矩形的大小。
我看到了一些与绘制矩形相关的问题,但是我没有看到任何使用 React hooks 的问题,这就是我决定创建问题的原因。
这是目前正在使用的代码,它给了我上面的结果。
import React, { useEffect, useRef, useState } from 'react';
interface CanvasProps {
width: number;
height: number;
}
type Coordinate = {
x: number;
y: number;
};
type Rectangle = {
start: Coordinate;
completed: boolean;
end?: Coordinate;
};
const Canvas = ({ width, height }: CanvasProps) => {
const canvasRef = useRef<HTMLCanvasElement>(null);
const [currentMousePosition, setCurrentMousePosition] = useState<Coordinate>({ x: 0, y: 0 });
const [isMouseDown, setMouseDown] = useState(false); …
Run Code Online (Sandbox Code Playgroud) reactjs ×2
typescript ×2
.net-6.0 ×1
asp.net-core ×1
c# ×1
json.net ×1
minimal-apis ×1
mnist ×1
python ×1
react-hooks ×1
tensorflow ×1