Skip to content
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 track cost time #153

Merged
merged 1 commit into from
Jan 22, 2025
Merged

Add track cost time #153

merged 1 commit into from
Jan 22, 2025

Conversation

tunmx
Copy link
Member

@tunmx tunmx commented Jan 22, 2025

No description provided.

Copy link

devloai bot commented Jan 22, 2025

Automatic code review is enabled for this repository. Reviewing this PR now.

Copy link

@devloai devloai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the performance tracking additions. The implementation is well-structured but needs some robustness improvements (null checks) and better documentation. The MNN precision change requires explanation as it could affect accuracy. Please also consider the naming and configurability suggestions to improve maintainability.

// cost spend
std::shared_ptr<inspirecv::TimeSpend> m_face_track_cost_;

bool m_enable_track_cost_spend_ = false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a more descriptive name for the member variable. m_enable_track_cost_spend_ could be renamed to m_enable_performance_tracking_ or m_track_perf_enabled_ to better reflect its purpose.

int32_t FaceSession::SetEnableTrackCostSpend(bool value) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SetEnableTrackCostSpend method should validate the TimeSpend object exists before using it. Add a null check for m_face_track_cost_ before calling Reset().

}

void FaceSession::PrintTrackCostSpend() {
if (m_enable_track_cost_spend_) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PrintTrackCostSpend method should validate the TimeSpend object exists. Add a null check for m_face_track_cost_ before accessing it:

Suggested change
if (m_enable_track_cost_spend_) {
if (m_enable_track_cost_spend_ && m_face_track_cost_) {

return ret;
}

int loop = 100;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benchmark loop count is hardcoded to 100. Consider making this configurable via command line argument to allow for different test scenarios.

MNN::BackendConfig bnconfig;
bnconfig.power = MNN::BackendConfig::Power_High;
bnconfig.precision = MNN::BackendConfig::Precision_High;
bnconfig.precision = MNN::BackendConfig::Precision_Normal;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed precision from High to Normal without explanation. This could impact model accuracy. Please document the rationale for this change, especially if it's related to the performance tracking feature.

@tunmx tunmx merged commit 78d20d8 into master Jan 22, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant