Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
a7660331a
tesseract
提交
9ae97508
T
tesseract
项目概览
a7660331a
/
tesseract
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tesseract
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9ae97508
编写于
5月 03, 2018
作者:
Z
zdenop
提交者:
GitHub
5月 03, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1551 from stweil/bigendian
Fix Tesseract for big endian machines
上级
f53290ac
21d5ce57
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
8 deletion
+30
-8
src/ccutil/helpers.h
src/ccutil/helpers.h
+2
-0
src/lstm/input.cpp
src/lstm/input.cpp
+2
-4
src/lstm/static_shape.h
src/lstm/static_shape.h
+26
-4
未找到文件。
src/ccutil/helpers.h
浏览文件 @
9ae97508
...
...
@@ -25,6 +25,7 @@
#ifndef TESSERACT_CCUTIL_HELPERS_H_
#define TESSERACT_CCUTIL_HELPERS_H_
#include <cassert>
#include <stdio.h>
#include <string.h>
#include <functional>
...
...
@@ -187,6 +188,7 @@ inline int IntCastRounded(float x) {
// Reverse the order of bytes in a n byte quantity for big/little-endian switch.
inline
void
ReverseN
(
void
*
ptr
,
int
num_bytes
)
{
assert
(
num_bytes
==
1
||
num_bytes
==
2
||
num_bytes
==
4
||
num_bytes
==
8
);
char
*
cptr
=
static_cast
<
char
*>
(
ptr
);
int
halfsize
=
num_bytes
/
2
;
for
(
int
i
=
0
;
i
<
halfsize
;
++
i
)
{
...
...
src/lstm/input.cpp
浏览文件 @
9ae97508
...
...
@@ -42,14 +42,12 @@ Input::~Input() {
// Writes to the given file. Returns false in case of error.
bool
Input
::
Serialize
(
TFile
*
fp
)
const
{
if
(
!
Network
::
Serialize
(
fp
))
return
false
;
if
(
fp
->
FWrite
(
&
shape_
,
sizeof
(
shape_
),
1
)
!=
1
)
return
false
;
return
true
;
return
Network
::
Serialize
(
fp
)
&&
shape_
.
Serialize
(
fp
);
}
// Reads from the given file. Returns false in case of error.
bool
Input
::
DeSerialize
(
TFile
*
fp
)
{
return
fp
->
FReadEndian
(
&
shape_
,
sizeof
(
shape_
),
1
)
==
1
;
return
shape_
.
DeSerialize
(
fp
)
;
}
// Returns an integer reduction factor that the network applies to the
...
...
src/lstm/static_shape.h
浏览文件 @
9ae97508
...
...
@@ -59,18 +59,40 @@ class StaticShape {
height_
,
width_
,
depth_
,
loss_type_
);
}
bool
DeSerialize
(
TFile
*
fp
)
{
int32_t
tmp
;
bool
result
=
fp
->
FReadEndian
(
&
batch_
,
sizeof
(
batch_
),
1
)
==
1
&&
fp
->
FReadEndian
(
&
height_
,
sizeof
(
height_
),
1
)
==
1
&&
fp
->
FReadEndian
(
&
width_
,
sizeof
(
width_
),
1
)
==
1
&&
fp
->
FReadEndian
(
&
depth_
,
sizeof
(
depth_
),
1
)
==
1
&&
fp
->
FReadEndian
(
&
tmp
,
sizeof
(
tmp
),
1
)
==
1
;
loss_type_
=
static_cast
<
LossType
>
(
tmp
);
return
result
;
}
bool
Serialize
(
TFile
*
fp
)
const
{
int32_t
tmp
=
loss_type_
;
return
fp
->
FWrite
(
&
batch_
,
sizeof
(
batch_
),
1
)
==
1
&&
fp
->
FWrite
(
&
height_
,
sizeof
(
height_
),
1
)
==
1
&&
fp
->
FWrite
(
&
width_
,
sizeof
(
width_
),
1
)
==
1
&&
fp
->
FWrite
(
&
depth_
,
sizeof
(
depth_
),
1
)
==
1
&&
fp
->
FWrite
(
&
tmp
,
sizeof
(
tmp
),
1
)
==
1
;
}
private:
// Size of the 4-D tensor input/output to a network. A value of zero is
// allowed for all except depth_ and means to be determined at runtime, and
// regarded as variable.
// Number of elements in a batch, or number of frames in a video stream.
int
batch_
;
int
32_t
batch_
;
// Height of the image.
int
height_
;
int
32_t
height_
;
// Width of the image.
int
width_
;
int
32_t
width_
;
// Depth of the image. (Number of "nodes").
int
depth_
;
int
32_t
depth_
;
// How to train/interpret the output.
LossType
loss_type_
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录