-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add feature/infer demo/se resnext50 #11708
Merged
Superjomn
merged 22 commits into
PaddlePaddle:develop
from
tensor-tang:feature/infer_demo/se-resnext50
Jun 27, 2018
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
22aafcb
Init
Superjomn f5d0783
init
Superjomn 2e739cf
add automatic model deploy
Superjomn 190a871
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Superjomn 904297e
upadte
Superjomn 1c0bbfd
update
Superjomn c34da73
update
Superjomn 8b827d0
refine
tensor-tang c2d9c42
Merge branch 'Superjomn-demo/mobilenet' into feature/infer_demo/se-re…
tensor-tang c583513
add se-renext50 infer demo
tensor-tang c94cacc
update url
tensor-tang 75e5084
Merge remote-tracking branch 'ups/develop' into feature/infer_demo/se…
tensor-tang fc568f4
refine and add ocr
tensor-tang e8b0dcb
update readme
tensor-tang d509021
add check refer
tensor-tang 7449fe7
update and enable gpu test
tensor-tang 46285ed
Merge remote-tracking branch 'ups/develop' into feature/infer_demo/se…
tensor-tang 5c8e323
fix issue on gpu
tensor-tang 7e7df49
Merge remote-tracking branch 'ups/develop' into feature/infer_demo/se…
tensor-tang 33b8ea8
update threshold
tensor-tang ba0401a
disable inference mobilenet test
tensor-tang 529915c
Merge remote-tracking branch 'ups/develop' into feature/infer_demo/se…
tensor-tang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,10 +66,37 @@ Record ProcessALine(const std::string& line) { | |
record.shape.push_back(std::stoi(s)); | ||
} | ||
LOG(INFO) << "data size " << record.data.size(); | ||
LOG(INFO) << "data shape " << record.shape.size(); | ||
LOG(INFO) << "data shape size " << record.shape.size(); | ||
return record; | ||
} | ||
|
||
void CheckOutput(const std::string& referfile, const PaddleTensor& output) { | ||
std::string line; | ||
std::ifstream file(referfile); | ||
std::getline(file, line); | ||
auto refer = ProcessALine(line); | ||
file.close(); | ||
|
||
size_t numel = output.data.length() / PaddleDtypeSize(output.dtype); | ||
LOG(INFO) << "predictor output numel " << numel; | ||
LOG(INFO) << "reference output numel " << refer.data.size(); | ||
EXPECT_EQ(numel, refer.data.size()); | ||
switch (output.dtype) { | ||
case PaddleDType::INT64: { | ||
for (size_t i = 0; i < numel; ++i) { | ||
EXPECT_EQ(static_cast<int64_t*>(output.data.data())[i], refer.data[i]); | ||
} | ||
break; | ||
} | ||
case PaddleDType::FLOAT32: | ||
for (size_t i = 0; i < numel; ++i) { | ||
EXPECT_NEAR( | ||
static_cast<float*>(output.data.data())[i], refer.data[i], 1e-3); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
/* | ||
* Use the native fluid engine to inference the demo. | ||
*/ | ||
|
@@ -111,6 +138,9 @@ void Main(bool use_gpu) { | |
LOG(INFO) << "output.size " << output.size(); | ||
auto& tensor = output.front(); | ||
LOG(INFO) << "output: " << SummaryTensor(tensor); | ||
|
||
// compare with reference result | ||
CheckOutput(FLAGS_refer, tensor); | ||
} | ||
|
||
TEST(demo, vis_demo) { Main(false /*use_gpu*/); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 需要再测下gpu的 |
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1e-3太大了。改成1e-7吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1e-7本地gpu跑了下,太小了。改为1e-6了。