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
G-API Smart Framing Demo #3421
base: master
Are you sure you want to change the base?
G-API Smart Framing Demo #3421
Conversation
|
||
namespace custom { | ||
|
||
const std::vector<std::string> coco_classes = { |
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.
I think you can load this from omz/data/dataset_calsses/coco_80cl.txt
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.
@mpashchenkov are aware about any examples of doing so for classes?
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.
FYI omz/demos/instance_segmentation_demo
(cases.py example for labels flag)
I think you can just add --labels
flag for path to file with labels.
@dbudniko, need to add tests for demo to omz/demos/tests/cases.py |
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.
Please delete or move to NOTE / TODO all commented code.
demos/README.md
Outdated
@@ -38,6 +38,7 @@ | |||
omz_demos_image_retrieval_demo_python | |||
omz_demos_segmentation_demo_cpp | |||
omz_demos_segmentation_demo_python | |||
omz_demos_smart_framing_demo_cpp |
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.
omz_demos_smart_framing_demo_cpp -->
omz_demos_smart_framing_demo_cpp_gapi
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.
Done
demos/README.md
Outdated
@@ -139,7 +140,8 @@ The Open Model Zoo includes the following demos: | |||
- [Pedestrian Tracker C++ Demo](./pedestrian_tracker_demo/cpp/README.md) - Demo application for pedestrian tracking scenario. | |||
- [Place Recognition Python\* Demo](./place_recognition_demo/python/README.md) - This demo demonstrates how to run Place Recognition models using OpenVINO™. | |||
- [Security Barrier Camera C++ Demo](./security_barrier_camera_demo/cpp/README.md) - Vehicle Detection followed by the Vehicle Attributes and License-Plate Recognition, supports images/video and camera inputs. | |||
- [Speech Recognition DeepSpeech Python\* Demo](./speech_recognition_deepspeech_demo/python/README.md) - Speech recognition demo: accepts an audio file with an English phrase on input and converts it into text. This demo does streaming audio data processing and can optionally provide current transcription of the processed part. | |||
- [Smart Framing C++ Demo](./smart_framing_demo/cpp_gapi/README.md) - Person Detection followed by the Smart Framing/Croping and optionally Super Resolution, supports images/video and camera inputs. |
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.
Smart Framing C++ G-API Demo
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.
Done
cv::GArray<custom::DetectedObject> yolo_detections; | ||
|
||
// Now build the graph | ||
cv::GMat in; |
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.
Please put graph 140 - 166 + GComputation to the beginning of main().
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.
???
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.
Please put graph after 221 line if it is possible
if (!FLAGS_no_show) { | ||
//Draw detections on original image | ||
for (const auto& el : objects) { | ||
std::cout << el << std::endl; |
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.
slog::debug << ...
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.
Done
cv::Rect init_rect; | ||
for (const auto& el : objects) { | ||
if (el.labelID == 0) {//person ID | ||
init_rect = init_rect | (cv::Rect)el; |
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.
static_cast < cv::Rect > (el)
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.
Done
} | ||
else if (FLAGS_at_sr == "3ch") { |
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.
} | |
else if (FLAGS_at_sr == "3ch") { | |
} else if (FLAGS_at_sr == "3ch") { |
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.
Done
} | ||
else { |
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.
} | |
else { | |
} else { |
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.
Done
} | ||
else { |
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.
} | |
else { | |
} else { |
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.
Done
} | ||
else { |
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.
} | |
else { | |
} else { |
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.
Done
} | ||
else { |
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.
} | |
else { | |
} else { |
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.
...
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.
Done
cv::rectangle(image, el, cv::Scalar{ 0,255,0 }, 2, cv::LINE_8, 0); | ||
cv::putText(image, el.label, el.tl(), cv::FONT_HERSHEY_SIMPLEX, 1.0, { 0,255,0 }, 2); |
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.
Would it be better to draw these with render primitives in graph?
Up to you.
auto entriesNum = sideW * sideH; | ||
const float* output_blob = (float*)blob.data; | ||
|
||
auto postprocessRawData = /*(yoloVersion == YOLO_V4 || yoloVersion == YOLO_V4_TINY) ?*/ sigmoid;// : linear; |
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.
Does demo have unsupported scenarios?
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.
Done
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.
Done
for (int i = 0; i < entriesNum; ++i) { | ||
int row = i / sideW; | ||
int col = i % sideW; | ||
//for (int n = 0; n < region.num; ++n) { |
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.
Looks like legacy
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.
Done
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.
Done
int obj_index = calculateEntryIndex(entriesNum, /*region.coords*/ region_coords, /*region.classes*/ region_classes, n * entriesNum + i, /*region.coords*/ region_coords); | ||
int box_index = calculateEntryIndex(entriesNum, /*region.coords*/ region_coords, /*region.classes*/ region_classes, n * entriesNum + i, 0); |
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.
And here
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.
Done
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.
Done
//double height = std::exp(output_blob[box_index + 3 * entriesNum]) * region.anchors[2 * n + 1] * original_im_h / scaleH; | ||
//double width = std::exp(output_blob[box_index + 2 * entriesNum]) * region.anchors[2 * n] * original_im_w / scaleW; |
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.
And these
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.
Done
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.
Done
cv::BORDER_CONSTANT, cv::Scalar::all(127)); | ||
} | ||
else { | ||
image.copyTo(out); |
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.
Is this copy necessary? You can get image
for next operations from previous graph stage.
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.
yes. we need this copy.
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.
Why don't you use frame from cv::gapi::copy() instead?
static void run(const cv::Mat & in, | ||
cv::Mat & out) { | ||
int h = in.size[2]; | ||
int w = in.size[3]; |
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.
static void run(const cv::Mat & in, | |
cv::Mat & out) { | |
int h = in.size[2]; | |
int w = in.size[3]; | |
static void run(const cv::Mat& in, | |
cv::Mat& out) { | |
int h = in.size[2]; | |
int w = in.size[3]; |
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.
Done
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.
Done
std::transform(in_p, in_p + h * w, out_p, | ||
[](float v) { return static_cast<uint8_t>(v * 255); }); | ||
} |
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.
Can it be:
out = in * 255;
Are in and out 1-channel cv::Mat?
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.
Need to check with Tolik. This is his kernel.
test_cases=combine_cases( | ||
TestCase(options={'--no_show': None, '-at_sr': '3ch', | ||
**MONITORS, | ||
'-i': DataPatternArg('smart-classroom-demo'), |
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.
Ok. I will add comment about it bit later.
|
||
GAPI_OCV_KERNEL(OCVSuperResolutionPostProcessingKernel, custom::GSuperResolutionPostProcessingKernel) { | ||
static void run(const cv::Mat & image, cv::Mat & out) { | ||
float* outputData = (float*)image.data; |
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.
c-style cast
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.
Done
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.
Done
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.
There's still C-style cast
@Wovchena please review. |
I'm not sure when I get to it |
-t_conf_yolo Optional. YOLO v4 Tiny confidence threshold. | ||
-t_box_iou_yolo Optional. YOLO v4 Tiny box IOU threshold. | ||
-advanced_pp Optional. Use advanced post-processing for the YOLO v4 Tiny. | ||
-apply_sr Optional. Use Super Resolution post processing model. |
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.
Can't we decide whether to apply super resolution postprocessing based on was model provided or not?
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.
Done
-limit "<num>" Optional. Number of frames to store in output. If 0 is set, all frames are stored. | ||
-res "<WxH>" Optional. Set camera resolution in format WxH. | ||
-m_yolo "<path>" Required. Path to an .xml file with a trained YOLO v4 Tiny model. | ||
-at_sr "<type>" Required if Super Resolution is not disabled by apply_sr=false flag. Architecture type: Super Resolution - 3 channels input (3ch) or 1 channel input (1ch). |
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.
Both single-image-super-resolution (1032 and 1033) models accept 3 channel images. What for 1 channel input support?
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.
Some use cases and SR models requires 1ch input. 3ch OMZ models are currently default. But we want to have optional 1ch scenario support in place.
* \brief This function shows a help message | ||
*/ | ||
|
||
static void showUsage() { |
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.
We've redesigned a usage message for demos, see example here:
void parse(int argc, char* argv[]) { |
Please, update in accordance with it:
- move to main.cpp
- wrap into anonymous namespace
- define flag and it's message nearby like this:
constexpr char h_msg[] = "show the help message and exit";
DEFINE_bool(h, false, h_msg);
- Mark optional parameters with [ ]
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.
Done
|
||
#include <gflags/gflags.h> | ||
#include <utils/default_flags.hpp> | ||
#include <models/detection_model.h> |
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.
Transitive includes is a bad thing, please include models/detection_model.h
in file where you actually use it.
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.
Done
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.
Done
|
||
#include <utils/slog.hpp> | ||
|
||
namespace IE = InferenceEngine; |
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.
Does it make sense?
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.
Done
|
||
|
||
|
||
//#include "smart_framing_demo_gapi.hpp" |
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.
??? And demo works without this include. It is weird
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.
Understood. Need to remove.
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.
Done
|
||
|
||
namespace util { | ||
//bool ParseAndCheckCommandLine(int argc, char *argv[]) { |
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.
Why?
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.
Ok. Understood. New behavior is the same as in IFD.
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.
MB need remove this code + include
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.
Done
} | ||
|
||
|
||
/** ---------------- Main graph of demo ---------------- **/ |
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.
Comment without graph :)
cv::GArray<custom::DetectedObject> yolo_detections; | ||
|
||
// Now build the graph | ||
cv::GMat in; |
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.
Please put graph after 221 line if it is possible
DEFINE_INPUT_FLAGS | ||
DEFINE_OUTPUT_FLAGS | ||
|
||
static const char help_message[] = "Print a usage message."; |
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.
It is unused file now, isn't it?
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.
Removed after cleanup
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.
Graph code rearranged. Don't completely understand "put graph after 221 line "
} | ||
}; | ||
|
||
using GPostProc = cv::GOpaque<YOLOv4TinyPostProcessing>; |
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.
Unused?
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.
removed
cv::BORDER_CONSTANT, cv::Scalar::all(127)); | ||
} | ||
else { | ||
image.copyTo(out); |
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.
Why don't you use frame from cv::gapi::copy() instead?
Will we continue and merge? |
@dmatveev FYI |
using GDetections = cv::GArray<DetectedObject>; | ||
using GLabels = cv::GArray<std::string>; | ||
|
||
G_API_OP(GYOLOv4TinyPostProcessingKernel, < GDetections(cv::GMat, cv::GMat, cv::GMat, GLabels, float, float, bool) >, "custom.yolov4_tiny_post_processing") { |
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.
Operation shouldn't be called Kernel, as a Kernel is an implementation to the Operation.
struct DetectedObject : public cv::Rect2f | ||
{ | ||
unsigned int labelID; | ||
std::string label; | ||
float confidence; | ||
}; |
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.
I doubt is subclassing from Rect2f is a good idea.. Not sure if it is bad, too.
The reason we usually don't use structures like this in pipeline and instead produce multiple arrays of different types is that it is easier to process those arrays with other functions like infer-list
without any extra custom code.
} | ||
}; | ||
|
||
G_API_OP(GSmartFramingKernel, <cv::GMat(cv::GMat, GDetections)>, "custom.smart_framing") { |
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.
I assume it should be SmartCrop
isn't it?
cv::GMatDesc out_desc(CV_8U /* depth */, in.dims[1] /* channels */, cv::Size(in.dims[3], in.dims[2]), false /* planar */); | ||
return out_desc; | ||
} | ||
}; |
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.
Please drop Kernel suffix from all the operations
// NB: Input is ND mat. | ||
return cv::GMatDesc{ CV_8U, in.dims[1], cv::Size(in.dims[3], in.dims[2]) }; | ||
} | ||
}; |
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.
Don't we have this in our base framework? Should we plan extending the existing function instead?
static cv::gapi::GKernelPackage getKernelPackage(const std::string& type) { | ||
if (type == "opencv") { | ||
return cv::gapi::combine(cv::gapi::core::cpu::kernels(), | ||
cv::gapi::imgproc::cpu::kernels()); | ||
} else if (type == "fluid") { | ||
return cv::gapi::combine(cv::gapi::core::fluid::kernels(), | ||
cv::gapi::imgproc::fluid::kernels()); | ||
} else { | ||
throw std::logic_error("Unsupported kernel package type: " + type); | ||
} | ||
GAPI_Assert(false && "Unreachable code!"); | ||
} |
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.
This probably doesn't make sense as so far there is no image processing kernels in the pipeline?
auto out_b = custom::GCvt32Fto8U::on(cv::gapi::infer<SRNet>(b)); | ||
auto out_g = custom::GCvt32Fto8U::on(cv::gapi::infer<SRNet>(g)); | ||
auto out_r = custom::GCvt32Fto8U::on(cv::gapi::infer<SRNet>(r)); | ||
out_sr_pp = cv::gapi::merge3(out_b, out_g, out_r); |
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.
Ok, so this in theory could leverage Fluid but in this face "Cvf32Fto8U" should be implemented as a Fluid kernel.
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.
..yes they can be custom
|
||
cv::merge(imgPlanes, out); | ||
} | ||
}; |
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.
Can we unroll this kernel into a graph is possible? I see its treshold
/convertTo
/merge
path can run on Fluid as well.
} | ||
}; | ||
|
||
GAPI_OCV_KERNEL(OCVSmartFramingMakeBorderKernel, custom::GSmartFramingMakeBorderKernel) { |
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.
This is harder than I thought...
As it has a lot of temporary Mats created inside, those can be moved to State (as we turn this kernel into Stateful) to avoid run-time memory allocations.
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.
There are debug prints. Please remove them
@@ -0,0 +1,110 @@ | |||
# G-API Smart Framing Demo | |||
|
|||
This demo shows how to perform smart framing using G-API. |
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.
Please add a gif to show how demo looks.
--t_box_iou_yolo Optional. YOLO v4 Tiny box IOU threshold. | ||
--advanced_pp Optional. Use advanced post-processing for the YOLO v4 Tiny. | ||
--show Optional. (Don't) show output. | ||
-u Optional. List of monitors to show initially. |
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.
This is misaligned with what the demo actually prints.
<< "\n\t[--loop] " << loop_msg | ||
<< "\n\t[ -o <OUTPUT>] " << o_msg | ||
<< "\n\t[--labels] " << labels_msg | ||
<< "\n\t[--crop_with_borders] " << crop_with_borders_msg |
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.
Please sort flags:
- -h
- --help
- required flags
- -i
- optional flags sorted alphabetically
cv::GArray<std::string> labels; | ||
|
||
std::tie(blob26x26, blob13x13) = cv::gapi::infer<YOLOv4TinyNet>(in); | ||
yolo_detections = custom::GYOLOv4TinyPostProcessingKernel::on(in, blob26x26, blob13x13, labels, FLAGS_t_conf_yolo, FLAGS_t_box_iou_yolo, FLAGS_advanced_pp); |
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.
There's warning on windows warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
. Please put explicit cast
cv::Mat SF_resized_ROI; | ||
cv::Size target_size; | ||
target_size.height = image.size().height; | ||
target_size.width = even_rect.width * (static_cast<float>(image.size().height) / static_cast<float>(even_rect.height)); |
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.
There's warning on Windows: '=': conversion from 'float' to '_Tp', possible loss of data
. Please resolve it
auto* in_p = in.ptr<const float>(); | ||
|
||
std::transform(in_p, in_p + h * w, out_p, | ||
[](float v) { return static_cast<uint8_t>(v * 255); }); |
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.
Why not in.convertTo()
?
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.
There's even comment about it on top of this kernel
To run the demo, please provide paths to the model in the IR format, and to an input video, image, or folder with images: | ||
|
||
```bash | ||
./smart_framing_demo_gapi/ -m <path_to_model> -i <path_to_file> |
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.
./smart_framing_demo_gapi/ -m <path_to_model> -i <path_to_file> | |
./smart_framing_demo_gapi -m <path_to_model> -i <path_to_file> |
constexpr char yolo_m_msg[] = "path to an .xml file with a trained YOLO v4 Tiny model."; | ||
DEFINE_string(m_yolo, "", yolo_m_msg); |
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.
constexpr char yolo_m_msg[] = "path to an .xml file with a trained YOLO v4 Tiny model."; | |
DEFINE_string(m_yolo, "", yolo_m_msg); | |
constexpr char m_msg[] = "path to an .xml file with a trained YOLO v4 Tiny model."; | |
DEFINE_string(m, "", m_msg); |
Could you make it just m
: --m_yolo
->-m
because it's the primal model of the demo
|
||
GAPI_OCV_KERNEL(OCVSuperResolutionPostProcessingKernel, custom::GSuperResolutionPostProcessingKernel) { | ||
static void run(const cv::Mat & image, cv::Mat & out) { | ||
float* outputData = (float*)image.data; |
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.
There's still C-style cast
|
||
} // anonymous namespace | ||
|
||
|
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.
Two blank lines are usually prohibited for C++. It's not Python
@TolyaTalamanov @mpashchenkov @OrestChura please review this draft implementation