Base class for detecting 90 objects of the COCO dataset.
Input is an image (cv:Mat).
Output is a struct of detection results, named TFSSDResult
.
Sample code :
Mat img = cv::imread("sample_tfssd.jpg");
auto tfssd = vitis::ai::TFSSD::create
("ssd_resnet_50_fpn_coco_tf",true);
auto results = tfssd->run(img);
for(const auto &r : results.bboxes){
auto label = r.label;
auto x = r.x * img.cols;
auto y = r.y * img.rows;
auto width = r.width * img.cols;
auto height = r.height * img.rows;
auto score = r.score;
std::cout << "RESULT: " << label << "\t" << x << "\t" << y << "\t" <<
width
<< "\t" << height << "\t" << score << std::endl;
}
Display of the model results:
Figure 1. detection result
Quick Function Reference
The following table lists all the functions defined in the vitis::ai::TFSSD
class:
Type | Name | Arguments |
---|---|---|
std::unique_ptr< TFSSD > |
create |
|
vitis::ai::TFSSDResult
|
run |
|
std::vector< vitis::ai::TFSSDResult > |
run |
|
int | getInputWidth |
|
int | getInputHeight |
|
size_t | get_input_batch |
|