Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit ead9271

Browse files
authored
Fix virtualenv issue in object detection notebook; Fix Windows build error for absl::GetCurrentTimeNanos() (#334)
* Add virtualenv step to isolate yolov4 model conversion * Fix Windows build error for absl::GetCurrentTimeNanos() * Revert metadata changes in object detection notebook
1 parent 3437cfe commit ead9271

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

examples/notebooks/OpenVINO_TensorFlow_object_detection_example.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@
194194
"else:\n",
195195
" path = \"{0}/openvino_tensorflow/examples/\".format(OVTF_DIR)\n",
196196
"%cd {path}\n",
197-
"!chmod +x convert_yolov4.sh && bash convert_yolov4.sh\n",
197+
"!python3 -m pip install virtualenv\n",
198+
"!virtualenv env\n",
199+
"!source env/bin/activate && chmod +x convert_yolov4.sh && bash convert_yolov4.sh && deactivate\n",
198200
"# Once the model conversion is completed; move back to outside of examples directory\n",
199201
"%cd ../"
200202
]

openvino_tensorflow/kernels/encapsulate_op.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
EXPAND(m(__VA_ARGS__)) // L1431 op_kernel.h
4545
#endif
4646

47+
#ifdef _WIN32
48+
#define GetCurrentTimeNanos() profiler::GetCurrentTimeNanos()
49+
#else
50+
#define GetCurrentTimeNanos() absl::GetCurrentTimeNanos()
51+
#endif
52+
4753
using namespace std;
4854

4955
namespace tensorflow {
@@ -211,9 +217,9 @@ void NGraphEncapsulateOp::Compute(OpKernelContext* ctx) {
211217
if (api::IsRewritePassEnabled() &&
212218
s_tf_timing_run_enabled_map[m_cluster_id]) {
213219
// Measure the timing of cluster through force TF run
214-
int64_t start_ns = absl::GetCurrentTimeNanos();
220+
int64_t start_ns = GetCurrentTimeNanos();
215221
OP_REQUIRES_OK(ctx, Fallback(ctx));
216-
int64_t duration_in_ms = (absl::GetCurrentTimeNanos() - start_ns) / 1e6;
222+
int64_t duration_in_ms = (GetCurrentTimeNanos() - start_ns) / 1e6;
217223
OVTF_VLOG(1) << "Iter: " << m_iter;
218224
OVTF_VLOG(1) << "TF: Cluster " << m_cluster_id << " took " << duration_in_ms
219225
<< " ms.";
@@ -409,9 +415,9 @@ void NGraphEncapsulateOp::Compute(OpKernelContext* ctx) {
409415
OVTF_VLOG(4) << "NGraphEncapsulateOp::Compute call starting for cluster "
410416
<< m_cluster_id;
411417
try {
412-
int64_t start_ns = absl::GetCurrentTimeNanos();
418+
int64_t start_ns = GetCurrentTimeNanos();
413419
ng_exec->Call(ng_inputs, ng_func_outputs, multi_req_execution);
414-
int64_t duration_in_ms = (absl::GetCurrentTimeNanos() - start_ns) / 1e6;
420+
int64_t duration_in_ms = (GetCurrentTimeNanos() - start_ns) / 1e6;
415421
OVTF_VLOG(1) << "Iter: " << m_iter;
416422
OVTF_VLOG(1) << "OVTF: Cluster " << m_cluster_id << " took "
417423
<< duration_in_ms << " ms.";

0 commit comments

Comments
 (0)