Property Types#
-
class IProperty#
Subclassed by visionflow::props::FeatureMap, visionflow::props::IRegionList, visionflow::props::Image, visionflow::props::MultiNamesPolygonRegionList, visionflow::props::PolygonRegionList, visionflow::props::PolygonWithStringMapRegionList, visionflow::props::RawImageInfo, visionflow::props::RegionMatchResultList, visionflow::props::RotateRectRegionList, visionflow::props::StringMessage, visionflow::props::TaggedPolygonList, visionflow::props::ViewList
-
class Image : public visionflow::props::IProperty#
Property Image.
Public Functions
-
explicit Image(const visionflow::Image &image)#
Construct a new Image object.
- Parameters:
image – visionflow::Image image data.
-
Image(const Image &rhs)#
Copy constructor.
Only copy the image data pointer and raw image infomation, not the data. If you want to copy the data, you should use visionflow::Image::clone().
- Parameters:
rhs – Other Image.
-
Image &operator=(const Image &rhs)#
Assignment operator.
Only copy the image data pointer and raw image infomation, not the data. If you want to copy the data, you should use visionflow::Image::clone().
-
const visionflow::Image &image() const#
Get image data.
- Returns:
NO_DISCARD const visionflow::Image& image data.
-
Image &set_image(const visionflow::Image &image)#
Set the image data.
- Parameters:
image – visionflow::Image image data.
- Returns:
Image& reference to this object.
Public Static Functions
-
static size_t DumpPrefixLength()#
The property image data dumped with a length-fixed prefix. You can convert the binary data into a common encoded image data by removing the prefix.
-
explicit Image(const visionflow::Image &image)#
-
class RawImageInfo : public visionflow::props::IProperty#
Property to save the raw image information to speed up the image processing.
Public Functions
-
const std::string &file_path() const#
Get image file path.
- Returns:
const std::string& if from_camera() is true, return the camera id.
-
uint32_t channels(size_t visual_idx = 0) const#
Get channel of {visual_idx}th visual.
- Parameters:
visual_idx – Visual index
- Returns:
NO_DISCARD Channel of {visual_idx}th visual.
-
visionflow::img::Image::Depth depth(size_t visual_idx = 0) const#
Get depth of {visual_idx}th visual.
- Parameters:
visual_idx – Visual index
- Returns:
NO_DISCARD Depth of {visual_idx}th visual.
-
const std::string &camera_id() const#
Get image camera id.
- Returns:
const std::string& if from_camera() is false, return file path.
-
bool from_camera() const#
Get whether the image is from camera.
- Returns:
NO_DISCARD true for camera, false for file.
-
const Tags &tags() const#
Get the tags of the raw image.
- Returns:
NO_DISCARD const Tags & the tags of the raw image.
-
Tags &tags()#
Get the mutable tags of the raw image.
- Returns:
NO_DISCARD Tags & the mutable tags of the raw image.
-
const visionflow::Image &thumbnail_image() const#
Get the thumbnail of the raw image.
- Returns:
NO_DISCARD the thumbnail of the raw image.
-
const std::string &image_fingerprint() const#
Get the image fingerprint of the raw image.
- Returns:
NO_DISCARD the fingerprint of the raw image.
-
RawImageInfo &set_info_from_image(const img::Image &image, bool with_fingerprint = false, size_t thumbnail_long_side = 0)#
Collect base image infomation from the raw image object.
- Parameters:
image – The raw image.
with_fingerprint – Save the image fingerprint or not. Typically, when importing images into the project, you should set this parameter to True. When deploying to a production environment, you can set this parameter to False to skip computing image fingerprints and improve speed.
thumbnail_long_side – The thumbnail long side length. If not specified, the thumbnail size will be zero and the thumbnail image will be empty.
- Returns:
-
RawImageInfo &set_file_path(const std::string &file_path)#
Set the file path.
- Parameters:
file_path – Image file path.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_camera_id(const std::string &camera_id)#
Set the camera id.
- Parameters:
camera_id – Image camera id.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_import_time(int64_t import_time)#
Set the import time.
- Parameters:
import_time – Image import time.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_tags(const Tags &tags)#
Set the tags of the raw image.
- Parameters:
tags – The tags of the raw image.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo &set_image_size(geometry::Size2f image_size)#
Set the raw image size.
Note
It’s not recommended to use this function. Use set_info_from_image() instead.
- Parameters:
image_size – The raw image size.
- Returns:
-
RawImageInfo &set_channel_and_depth(const std::vector<uint32_t> &channels, const std::vector<visionflow::img::Image::Depth> &depth)#
Set the channel and depth information of the raw image. which could be replace with set_info_from_image()
- Parameters:
channels –
depth –
- Returns:
-
RawImageInfo &set_image_fingerprint(const std::string &image_fingerprint)#
Set the fingerprint of the raw image.
- Parameters:
image_fingerprint – Image fingerprint.
- Returns:
-
RawImageInfo &set_thumbnail_image(const visionflow::Image &thumbnail_image)#
Set the thumbnail image.
- Parameters:
thumbnail_image – Thumbnail image.
- Returns:
-
const std::string &file_path() const#
-
class ViewList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
Property ViewList contains multiple visionflow::TaggedView.
Public Types
-
using Iterator = std::map<std::string, TaggedView>::iterator#
ViewList iterator.
Public Functions
-
ViewList(const ViewList &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other ViewList.
-
virtual size_t size() const override#
Get the number of visionflow::TaggedView in this ViewList.
- Returns:
size_t The number of visionflow::TaggedView in this ViewList.
-
virtual std::vector<std::string> keys() const override#
Get all visionflow::TaggedView IDs in this list.
- Returns:
std::vector<std::string> The IDs of all visionflow::TaggedView in this list.
-
virtual const TaggedView &at(const std::string &view_key) const override#
Get the visionflow::TaggedView at the given view ID.
- Parameters:
view_key – The ID of the visionflow::TaggedView.
- Returns:
const TaggedView& The visionflow::TaggedView reference at the given ID.
-
virtual bool contains(const std::string &view_key) const override#
Whether the visionflow::TaggedView with the given ID exists in this view list.
- Parameters:
view_key – The ID of the visionflow::TaggedView.
- Returns:
true The visionflow::TaggedView with the given ID exists in this list.
- Returns:
false The visionflow::TaggedView with the given ID does not exist in this list.
-
virtual void erase(const std::string &view_key) override#
Remove the visionflow::TaggedView with the given ID. Nothing will be done if the ID is not found.
- Parameters:
view_key – The ID of the visionflow::TaggedView to be removed.
-
Iterator erase(const Iterator &pos)#
Remove the visionflow::TaggedView the Iterator referenced and return iterator to the next.
- Parameters:
pos – The Iterator of the visionflow::TaggedView to be removed.
- Returns:
The Iterator to the visionflow::TaggedView follows the removed view.
-
std::string add(const TaggedView &view)#
Add a new visionflow::TaggedView instance into this list. An new id will be generated for the view added.
- Parameters:
view – The visionflow::TaggedView to be added into this list.
- Returns:
std::string The view id generated by the list.
-
bool add(const Iterator &it)#
Add a new visionflow::TaggedView into this list. If the ID already exists, fail to add and return false.
- Parameters:
it – The Iterator of the visionflow::TaggedView to be added.
- Returns:
true If added successfully.
- Returns:
false If failed to add.
-
void update(const std::string &view_key, const TaggedView &new_view)#
Update visionflow::TaggedView specified by view_key with the new view. If view specified by view_key does not exist, the new visionflow::TaggedView instance new_view will be added into this list with key view_key.
- Parameters:
view_key – The key of the view to be updated.
new_view – The new visionflow::TaggedView to be updated.
-
Iterator find(const std::string &view_key)#
Get iterator to visionflow::TaggedView with id view_key.
- Parameters:
view_key – The id to be searched for.
- Returns:
Iterator The iterator to the visionflow::TaggedView with id view_key or The iterator to map::end if not found.
-
Iterator begin() const#
Get iterator pointing to the first element.
If the ViewList is empty, the returned iterator will be equal to end().
- Returns:
NO_DISCARD iterator pointing to the first element.
-
Iterator end() const#
Get iterator pointing to the element following the last element of ViewList.
This element acts as a placeholder. Attempting to access it results in undefined behavior.
- Returns:
NO_DISCARD iterator pointing to the element following the last element of ViewList.
-
ViewList tagged_views(visionflow::SplitTag split_tag) const#
Get the specified split tag ViewList.
- Parameters:
split_tag – visionflow::SplitTag split tag.
- Returns:
NO_DISCARD the specified split tag ViewList
-
std::vector<visionflow::View> views() const#
Get the visionflow::View corresponding to each visionflow::TaggedView.
- Returns:
NO_DISCARD the visionflow::View corresponding to each visionflow::TaggedView.
-
using Iterator = std::map<std::string, TaggedView>::iterator#
-
class TaggedPolygonList : public virtual visionflow::props::IProperty#
Property TaggedPolygonList contains multiple visionflow::TaggedPolygon.
Public Types
-
using Iterator = std::map<std::string, TaggedPolygon>::iterator#
TaggedPolygonList iterator.
Public Functions
-
~TaggedPolygonList() override#
Destructor of the TaggedPolygonList.
-
size_t size() const#
Get the number of visionflow::TaggedPolygon in this TaggedPolygonList.
- Returns:
size_t The number of visionflow::TaggedPolygon in this TaggedPolygonList.
-
bool empty() const#
Check whether the TaggedPolygonList is empty.
- Returns:
NO_DISCARD True if empty, false if not empty.
-
std::vector<std::string> keys() const#
Get all visionflow::TaggedPolygon keys in this TaggedPolygonList.
- Returns:
std::vector<std::string> The keys of all visionflow::TaggedPolygon in this TaggedPolygonList.
-
TaggedPolygon &at(const std::string ®ion_key) const#
Get the visionflow::TaggedPolygon at the given view ID.
- Parameters:
region_key – The key of the visionflow::TaggedPolygon.
- Returns:
const TaggedPolygon& The visionflow::TaggedPolygon reference at the given key.
-
bool contains(const std::string ®ion_key) const#
Check whether the visionflow::TaggedPolygon with the given key exists in this TaggedPolygonList.
- Parameters:
region_key – The key of the visionflow::TaggedPolygon.
- Returns:
True if exists, false if not exists.
-
std::string add(const TaggedPolygon &new_region)#
Add a new visionflow::TaggedPolygon instance with a new generated key into the TaggedPolygonList.
- Parameters:
new_region – The visionflow::TaggedPolygon to be added into the TaggedPolygonList.
- Returns:
std::string The new generated key of the added TaggedPolygon.
-
void erase(const std::string ®ion_key)#
Remove the visionflow::TaggedPolygon with the given key. Nothing will be done if the key not exists.
- Parameters:
region_key – The key of the visionflow::TaggedPolygon to be removed.
-
void update(const std::string ®ion_key, const TaggedPolygon &new_region)#
Update visionflow::TaggedPolygon specified by region_key. If the region_key does not exist, the new visionflow::TaggedPolygon instance will be added into the TaggedPolygonList with key region_key.
- Parameters:
region_key – The key of the view to be updated.
new_region – The new visionflow::TaggedPolygon to be updated.
-
TaggedPolygonList tagged_polygons(visionflow::SplitTag split_tag) const#
Get the TaggedPolygonList with specified split_tag.
- Parameters:
split_tag – The split tag.
- Returns:
TaggedPolygonList of all visionflow::TaggedPolygon with split_tag.
-
std::vector<geometry::Polygon2f> polygons() const#
Get the geometry::Polygon2f corresponding to each visionflow::TaggedPolygon.
- Returns:
NO_DISCARD the vector of geometry::Polygon2f.
-
Iterator begin() const#
Get iterator points to the first element of TaggedPolygonList.
Note
If the TaggedPolygonList is empty, the behavior is same as end().
- Returns:
The iterator points to the first element.
-
Iterator end() const#
Get iterator points to the element following the last element of TaggedPolygonList.
- Returns:
The iterator points to the element following the last element of TaggedPolygonList.
-
Iterator find(const std::string ®ion_key)#
Get iterator to visionflow::TaggedPolygon with id region_key.
- Parameters:
region_key – The id to be searched for.
- Returns:
Iterator The iterator points to the visionflow::TaggedPolygon with id region_key or The iterator to map::end if not found.
Public Static Functions
-
static TaggedPolygonList FromViewList(const ViewList &views)#
Construct a TaggedPolygonList object from a ViewList with the split_tag, tags and the region on raw image of the each TaggedView attached or represent.
- Parameters:
views – The ViewList used to convert to the TaggedPolygonList.
- Returns:
-
using Iterator = std::map<std::string, TaggedPolygon>::iterator#
-
struct IRegionList : public virtual visionflow::props::IProperty#
IRegionList Interface to represent a list of regions.
Each region in the list has it’s own unique id with which the region can be identified.
Subclassed by visionflow::props::MultiNamesPolygonRegionList, visionflow::props::PolygonRegionList, visionflow::props::PolygonWithStringMapRegionList, visionflow::props::RotateRectRegionList, visionflow::props::ViewList
Public Functions
-
virtual size_t size() const = 0#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
inline bool empty() const#
If the region list is empty or not.
- Returns:
true If the region list is empty.
- Returns:
false If the region list is not empty.
-
virtual std::vector<std::string> keys() const = 0#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const IRegion &at(const std::string ®ion_key) const = 0#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const = 0#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) = 0#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
virtual size_t size() const = 0#
-
class PolygonRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
PolygonRegionList Class to store list of PolygonRegion. Generally used as segmentation label.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const PolygonRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(const PolygonRegion ®ion)#
Add a new PolygonRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, const PolygonRegion &new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new PolygonRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class MultiNamesPolygonRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
MultiNamesPolygonRegionList Class to store list of MultiNamesPolygonRegion. Generally used as segmentation label.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const MultiNamesPolygonRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(const MultiNamesPolygonRegion ®ion)#
Add a new MultiNamesPolygonRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, const MultiNamesPolygonRegion &new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new MultiNamesPolygonRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class PolygonWithStringMapRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
PolygonWithStringMapRegionList Class to store list of PolygonWithStringMapRegion. Generally used as segmentation label.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const PolygonWithStringMapRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(const PolygonWithStringMapRegion ®ion)#
Add a new PolygonWithStringMapRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, const PolygonWithStringMapRegion &new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new PolygonWithStringMapRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
geometry::MultiPolygon2f to_multi_polygons(const std::string &specific_name) const#
Concat all polygon of regions with the specific_name into a geometry::MultiPolygon2f data structure.
- Parameters:
specific_name – the specific region name.
- Returns:
-
geometry::MultiPolygon2f to_multi_polygons() const#
Concat all polygon of regions in the list into a geometry::MultiPolygon2f data structure.
- Returns:
-
virtual size_t size() const override#
-
class RotateRectRegionList : public virtual visionflow::props::IRegionList, public virtual visionflow::props::IProperty#
List of RotateRect regions.
Public Functions
-
virtual size_t size() const override#
Interface to get the number of regions in this list.
- Returns:
size_t The number of regions in this list.
-
virtual std::vector<std::string> keys() const override#
Get all regions IDs in this list.
- Returns:
std::vector<std::string> The IDs of all regions in this list.
-
virtual const RotateRectRegion &at(const std::string ®ion_key) const override#
Interface to get the region at the given region ID.
- Parameters:
region_key – The ID of the region.
- Returns:
const IRegion& The region reference at the given ID.
-
virtual bool contains(const std::string ®ion_key) const override#
If the region with the given ID exists in this list.
- Parameters:
region_key – The ID of the region.
- Returns:
true The region with the given ID exists in this list.
- Returns:
false The region with the given ID does not exist in this list.
-
virtual void erase(const std::string ®ion_key) override#
Interface to remove the region at the given ID. Nothing will be done if the ID is not found.
- Parameters:
region_key – The ID of the region to be removed.
-
std::string add(const RotateRectRegion ®ion)#
Add a new RotateRectRegion instance into this list. An new id will be generated for the region added.
- Parameters:
region – The region to be added into this list.
- Returns:
std::string The region id generated by the list.
-
void update(const std::string ®ion_key, const RotateRectRegion &new_region)#
Update region specified by region_key with the new region. If region specified by region_key does not exist, the new RotateRectRegion instance new_region will be added into this list with key region_key.
- Parameters:
region_key – The key of the region to be updated.
new_region – The new region to be updated.
-
virtual size_t size() const override#
-
class FeatureMap : public visionflow::props::IProperty#
FeatureMap is a data structure used to store feature maps detected by each algorithm module. A FeatureMap stores a single-channel floating-point grayscale image for each label class according to the label class name of the detected target. It’s recommended that the value of the grayscale image is between 0 and 1.
Public Functions
-
void insert(const std::string &label_class, const visionflow::SubImage &feature_map)#
Insert feature map with label class name, multiple feature map with same class will be exist in the container if this function be called multiple times with same label_class name.
Note
The data of the image in the visionflow::SubImage will not be copied, which means that if you modify the data content in the image later, the data of the image in the inserted sub-image will also be modified. If this is not the behavior you expect, you can call visionflow::SubImage::clone() explicitly like below:
feature_map.insert("label-class", sub_image.clone());
- Parameters:
label_class – The label class name of the feature map.
feature_map – The feature map, which should be a single-channel floating-point grayscale image, and it’s recommended that the value of the grayscale image is between 0 and 1.
- Throws:
visionflow::excepts::InvalidArgument – if the feature map is not a single-channel floating-point grayscale image.
-
void set(const std::string &label_class, const std::vector<visionflow::SubImage> &feature_maps)#
Insert feature map with label class name, and the old feature maps will be replaced.
Note
The data of the image in the visionflow::SubImage will not be copied, which means that if you modify the data content in the image later, the data of the image in the inserted sub-image will also be modified.
- Parameters:
label_class – The label class name of the feature maps.
feature_maps – The feature map list, each sub-image in which should be a single-channel floating-point grayscale image, and it’s recommended that the value of the grayscale image is between 0 and 1.
- Throws:
visionflow::excepts::InvalidArgument – if any one of feature map in the list is not a single-channel floating-point grayscale image.
-
void remove(const std::string &label_class)#
Remove feature map specified by the label class name. Do nothing if the class name not found.
- Parameters:
label_class – The key of the feature map to be removed.
-
bool contains(const std::string &label_class) const#
Check if the feature map exists in the container.
- Parameters:
label_class – The class name of the feature map
- Returns:
True if exists. Else false.
-
const std::vector<visionflow::SubImage> &get(const std::string &label_class) const#
Get the feature map specified by the name.
Note
Do not modify the data of the image in the visionflow::SubImage without clone, insert(const std::string &label_class, constvisionflow::SubImage &feature_map) for more details.
- Parameters:
label_class –
- Returns:
const std::vector<visionflow::SubImage> & The const reference of the feature maps.
-
std::vector<visionflow::SubImage> &get(const std::string &label_class)#
Get the feature map specified by the name.
- Parameters:
label_class –
- Returns:
std::vector<visionflow::SubImage> & The reference of the feature maps.
-
std::vector<std::string> keys() const#
Get all class names of all feature maps.
- Returns:
std::vector<std::string> The class names list.
-
void clear()#
Clear the feats container.
-
void set_pixel_class_names(const std::vector<std::string> &pixel_class_names)#
Set the class names. The index of the class name in the vector is mapped to the pixel value.
- Parameters:
pixel_class_names –
-
const std::vector<std::string> &get_pixel_class_names() const#
get the pixel class names.
-
void clear_pixel_classes()#
clear the pixel classes and names.
-
void insert(const std::string &label_class, const visionflow::SubImage &feature_map)#
-
enum visionflow::props::MatchResult#
Values:
-
enumerator kTpOrTn = 0#
-
enumerator kFn = 1#
-
enumerator kFp = 2#
-
enumerator kFnAndFp = 3#
-
enumerator kUnknown = 4#
-
enumerator kTpOrTn = 0#
-
class RegionMatchResultList : public visionflow::props::IProperty#
Property to store list of RegionMatchResult.
Public Functions
-
void set_truth_best_match(const std::string &truth_key, const std::string &prediction_key)#
Set the best match of the truth.
- Parameters:
truth_key – The key of the truth.
prediction_key – The key of the prediction.
-
void set_prediction_best_match(const std::string &prediction_key, const std::string &truth_key)#
Set the best match of the prediction.
- Parameters:
prediction_key – The key of the prediction.
truth_key – The key of the truth.
-
void set_view_match_result(const std::string &view_key, MatchResult match_result)#
Set the view match result.
- Parameters:
view_key – The key of the view.
match_result – The MatchResult of the view.
-
std::vector<std::string> truth_keys() const#
Get all ground truth keys.
- Returns:
NO_DISCARD
-
std::vector<std::string> prediction_keys() const#
Get all prediction keys.
- Returns:
NO_DISCARD
-
std::string truth_best_match(const std::string &truth_key) const#
Get the best match with truth key.
- Parameters:
truth_key – The key of the truth.
- Throws:
excepts::DataNotFound – If the truth key does’t exist.
- Returns:
NO_DISCARD
-
std::string prediction_best_match(const std::string &prediction_key) const#
Get the best match with prediction key.
- Parameters:
prediction_key – The key of the prediction.
- Throws:
excepts::DataNotFound – If the prediction key does’t exist.
- Returns:
NO_DISCARD
-
bool is_mutual_best_match(const std::string &truth_key, const std::string &prediction_key) const#
Determine whether truth_key and prediction_key are the best match for each other.
- Parameters:
truth_key – The key of the truth.
prediction_key – The key of the prediction.
- Throws:
excepts::DataNotFound – If the truth key or the prediction key does’t exist.
- Returns:
NO_DISCARD
-
MatchResult view_match_result(const std::string &view_key) const#
Get the match result of the view with the key.
- Parameters:
view_key – The key of the view.
- Throws:
excepts::DataNotFound – If the view key does’t exist.
- Returns:
NO_DISCARD
-
MatchResult match_result() const#
Get the match result of the sample.
- Returns:
NO_DISCARD
-
void set_truth_best_match(const std::string &truth_key, const std::string &prediction_key)#
-
class StringMessage : public visionflow::props::IProperty#
A property class that holds a string.
Property Base Types#
-
class View#
View after matrix transformation.
Subclassed by visionflow::TaggedView
Public Functions
-
View(const geometry::Matrix3f &mat, const geometry::Size2f &size)#
Constructor with transformation matrix and transformed View size.
- Parameters:
mat – Transformation matrix.
size – View size.
-
View(const View &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other View.
-
View &operator=(const View &rhs)#
Assignment operator.
It will not share the same references as the source object.
-
geometry::Ring2f view_on_raw_image() const#
Ring on raw image before View transformation.
- Returns:
NO_DISCARD geometry::Ring2f the result is Ring.
-
const geometry::Matrix3f &transform_matrix() const#
Get transformation matrix.
- Returns:
NO_DISCARD const geometry::Matrix3f& transformation matrix.
-
const geometry::Size2f &size() const#
Get transformed View size.
- Returns:
NO_DISCARD const geometry::Size2f& View size.
-
View(const geometry::Matrix3f &mat, const geometry::Size2f &size)#
-
enum visionflow::SplitTag#
Split tag for the TaggedView and TaggedPolygon.
Values:
-
enumerator kUnknown = 0#
Undivided set.
-
enumerator kTrain = 1#
Training set.
-
enumerator kTest = 2#
Test set.
-
enumerator kUnknown = 0#
-
class Tags#
Tags Manager. The Tags Manager supports two types of tags: value-tag and grouped-tag.
The value-tag is a string with any characters but should not contains “:=”, You can add any number of unique value-tags into a Tags Manager.
The grouped-tag is a string format like “<GROUP>:=<VALUE>”, the
GROUP
is the group name, and theVALUE
is the value of this group. The Tags Manager will only keep one value for each unique group. For example, All tags start with “date:=” will be remove from the Tags Manager when you add “date:=2021:12:31” into the Tags Manager.Public Functions
-
Tags &add(const std::string &tag)#
Add tag string to tag some object.
- Parameters:
tag – The tag string to be add, which should not be empty, otherwise it will be ignored and warning log will be print. In particular, if a tag string is formatted like “<GROUP>:=<VALUE>” (e.g. “date:=2021-12-31”), it will be recognized as a grouped-tag.
-
Tags &remove(const std::string &tag)#
Remove tag from the manager.
- Parameters:
tag – The tag to be removed. If it’s formatted like “<GROUP>:=”, the grouped-tag “GROUP” will be removed.
-
const std::string &at(const std::string &group) const#
Get the value of the tag with the group name.
- Parameters:
group – The group name. e.g. “date:=”
- Throws:
visionflow::excepts::DataNotFound – If the group name is not found.
- Returns:
const std::string& The value of the tag. If the tag is not found, an exception will be thrown.
-
bool contains(const std::string &tag) const#
Check if the manager contains the specific tag.
- Parameters:
tag – The specific tag. If it’s formatted like “<GROUP>:=”, The result represent that if the group exists in the manager.
- Returns:
true
- Returns:
false
-
size_t size() const#
Get number of tags in the manager.
- Returns:
size_t The number of tags in the manager.
-
std::vector<std::string> all() const#
Get all tags in the manager.
- Returns:
std::vector<std::string> The vector of tags.
-
std::vector<std::string> search(const std::string ®ex) const#
Search all tags matching the given regular expression.
- Parameters:
regex – The regular expression.
- Throws:
visionflow::excepts::InvalidArgument – Maybe the regex is invalid.
- Returns:
std::vector<std::string> Tags match with the regular expression
-
Tags &add(const std::string &tag)#
-
class TaggedView : public visionflow::IRegion, public visionflow::View#
View with split tag.
Public Functions
-
TaggedView()#
Construct a new TaggedView object by default.
-
explicit TaggedView(const View &view, SplitTag split_tag = kUnknown)#
Constructor with View and SplitTag.
- Parameters:
view – View.
split_tag – SplitTag. Default is kUnknown, which means undivided set.
-
TaggedView(const TaggedView &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other TaggedView.
-
TaggedView &operator=(const TaggedView &rhs)#
Assignment operator.
It will not share the same references as the source object.
- Parameters:
rhs – Other TaggedView.
- Returns:
TaggedView& reference to this object.
-
TaggedView(TaggedView &&rhs) noexcept#
Move constructor.
- Parameters:
rhs – Other rvalue TaggedView.
-
TaggedView &operator=(TaggedView &&rhs) noexcept#
Move assignment operator.
- Parameters:
rhs – Other rvalue TaggedView.
- Returns:
TaggedView& reference to this object.
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
virtual geometry::Polygon2f polygon() const override#
Get the polygon of the raw image before View transformation.
Note
Same as View::view_on_raw_image().
- Returns:
geometry::Polygon2f The polygon of the raw image before View transformation.
-
virtual geometry::Ring2f bounding_ring() const override#
Get the outer_boundary of the raw image before View transformation.
Note
Same as View::view_on_raw_image().
- Returns:
geometry::Ring2f The outer_boundary of the raw image before View transformation.
-
TaggedView &set_split_tag(SplitTag split_tag)#
Set the split tag.
- Parameters:
split_tag – SplitTag.
- Returns:
TaggedView& reference to this object.
-
TaggedView &set_tags(const Tags &tags)#
Set the tags.
-
const geometry::MultiPolygon2f &view_masks() const#
Get the view masks.
ViewMasks is a geometric representation of a set of masks based on the coordinates of the view window, where images and annotations at corresponding positions in the view are masked during training and inference.
- Returns:
const geometry::MultiPolygon2f& The view mask.
-
geometry::MultiPolygon2f &view_masks()#
Get the view masks.
- Returns:
geometry::MultiPolygon2f& The mutable view masks.
-
TaggedView &set_view_masks(const geometry::MultiPolygon2f &masks)#
Set the view masks.
See also
- Parameters:
masks – The view mask polygons.
- Returns:
TaggedView& The TaggedView self.
-
TaggedView()#
-
class TaggedPolygon#
TaggedPolygon represents a polygon region on raw image with dataset and tags information.
Public Functions
-
TaggedPolygon()#
Default constructor.
-
const geometry::Polygon2f &polygon() const#
Get the polygon region of the TaggedPolygon.
- Returns:
geometry::Polygon2f The polygon region.
-
TaggedPolygon &set_polygon(const geometry::Polygon2f &poly)#
Set the polygon region to the TaggedPolygon.
- Parameters:
poly – The polygon region to be set.
- Returns:
TaggedPolygon& The TaggedPolygon itself.
-
SplitTag split_tag() const#
Get the SplitTag of the TaggedPolygon.
- Returns:
SplitTag
-
TaggedPolygon &set_split_tag(SplitTag split_tag)#
Set the SplitTag to TaggedPolygon.
- Parameters:
split_tag – The SplitTag to be set.
- Returns:
TaggedPolygon& The TaggedPolygon itself.
-
const Tags &tags() const#
Get the Tags of the TaggedPolygon.
- Returns:
-
TaggedPolygon &set_tags(const Tags &tags)#
Set tags to the TaggedPolygon.
- Parameters:
tags –
- Returns:
TaggedPolygon& The TaggedPolygon itself.
Public Static Functions
-
static TaggedPolygon FromTaggedView(const TaggedView &tagged_view)#
Construct a TaggedPolygon from a TaggedView with the split_tag, tags and the region on raw image the TaggedView attached or represent.
- Parameters:
tagged_view – The visionflow::TaggedView used to convert to a TaggedPolygon.
- Returns:
-
TaggedPolygon()#
-
class IRegion#
IRegion is an interface to represent a region in the coordinate system. Each region is defined by a ring and a name string.
Subclassed by visionflow::PolygonRegion, visionflow::RotateRectRegion, visionflow::TaggedView
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const = 0#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
virtual geometry::Polygon2f polygon() const = 0#
Interface to get polygon of the region.
- Returns:
geometry::Polygon2f the polygon representing this region.
-
inline virtual geometry::Ring2f bounding_ring() const#
Interface to get the outer_boundary of this region.
- Returns:
geometry::Ring2f The outer_boundary of this region.
-
virtual IRegion &set_name(const std::string &name)#
Set the name of this region.
- Parameters:
name – The new name of this region.
- Returns:
IRegion& This region.
-
virtual std::string name() const#
Interface to get name of this region.
- Returns:
std::string
-
virtual float score() const#
Interface to get score of this region.
Default implementation returns 1.0F, Developers can override this method to return the score of the region in their own way. But it’s recommended that the score should be in [0, 1].
- Returns:
float The score of this region.
-
inline virtual geometry::Radian angle() const#
Interface to get rotate angle of this region.
- Returns:
geometry::Radian The angle of this region.
-
virtual std::shared_ptr<IRegion> clone() const = 0#
-
class PolygonRegion : public visionflow::IRegion#
Label Region described with polygon, generally used for segmentation.
Subclassed by visionflow::MultiNamesPolygonRegion, visionflow::PolygonWithStringMapRegion
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
PolygonRegion &set_polygon(const geometry::Polygon2f &polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
PolygonRegion& This region.
-
virtual geometry::Polygon2f polygon() const override#
Get the Polygon of segmentation region.
- Returns:
geometry::Polygon2f The Polygon of segmentation region.
-
inline virtual PolygonRegion &set_name(const std::string &name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
PolygonRegion& This region.
-
inline virtual PolygonRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
PolygonRegion& This region.
-
PolygonRegion &set_angle(const geometry::Radian &angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
PolygonRegion& This region.
-
virtual geometry::Radian angle() const override#
Interface to get the rotate_angle of this region.
- Returns:
geometry::Radian The rotate_angle of this region.
-
virtual geometry::Ring2f bounding_ring() const override#
Interface to get the outer_boundary of this region.
- Returns:
geometry::Ring2f The outer_boundary of this region.
-
virtual float area() const override#
Get the area of this region.
- Returns:
float The area of this region.
-
virtual std::shared_ptr<IRegion> clone() const override#
-
class MultiNamesPolygonRegion : public visionflow::PolygonRegion#
Label Region described with polygon and names, generally used for classification.
Public Functions
-
inline MultiNamesPolygonRegion &set_polygon(const geometry::Polygon2f &polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
inline virtual MultiNamesPolygonRegion &set_name(const std::string &name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
MultiNamesPolygonRegion& This region.
-
inline virtual MultiNamesPolygonRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
PolygonRegionNames& This region.
-
inline MultiNamesPolygonRegion &set_angle(const geometry::Radian &angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
MultiNamesPolygonRegion &set_name_scores(const std::map<std::string, float> &name_scores)#
Set the names and scores from softmax of this region.
- Parameters:
name_scores – The names and scores to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
std::map<std::string, float> name_scores() const#
Interface to get the names and scores from softmax of this region.
- Returns:
std::map<std::string, float> the names and scores from softmax of this region.
-
MultiNamesPolygonRegion &set_logic_scores(const std::map<std::string, float> &logic_scores)#
Set the names and scores from fc layer of this region.
- Parameters:
logic_scores – The names and scores to be set.
- Returns:
MultiNamesPolygonRegion& This region.
-
std::map<std::string, float> logic_scores() const#
Interface to get names and scores from fc layer of this region.
- Returns:
std::map<std::string, float> names and scores from fc layer of this region.
-
inline MultiNamesPolygonRegion &set_polygon(const geometry::Polygon2f &polygon)#
-
class PolygonWithStringMapRegion : public visionflow::PolygonRegion#
Label Region described with polygon and names, generally used for classification.
Public Functions
-
inline PolygonWithStringMapRegion &set_polygon(const geometry::Polygon2f &polygon)#
Set the polygon of this region.
- Parameters:
polygon – The polygon of this region to be set.
- Returns:
PolygonWithStringMapRegion& This region.
-
inline virtual PolygonWithStringMapRegion &set_name(const std::string &name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
PolygonWithStringMapRegion& This region.
-
inline virtual PolygonWithStringMapRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
PolygonRegionNames& This region.
-
inline PolygonWithStringMapRegion &set_angle(const geometry::Radian &angle)#
Set the rotate angle of this region.
See also
- Parameters:
angle – The rotate angle to be set.
- Returns:
PolygonWithStringMapRegion& This region.
-
PolygonWithStringMapRegion &set_additional_map(const std::map<std::string, std::string> &additional_map)#
Set the additional map.
- Parameters:
additional_map – The map to be set.
- Returns:
PolygonWithStringMapRegion& This region.
-
std::map<std::string, std::string> additional_map() const#
Interface to get the additional map.
- Returns:
std::map<std::string, std::string> the additional map.
-
inline PolygonWithStringMapRegion &set_polygon(const geometry::Polygon2f &polygon)#
-
class RotateRectRegion : public visionflow::IRegion#
RotateRectRegion is a region type used to describe an rectangle region with direction.
Public Functions
-
virtual std::shared_ptr<IRegion> clone() const override#
Copy this region instance.
- Returns:
std::shared_ptr<IRegion> copy of this region.
-
RotateRectRegion &set_rotate_rect(const geometry::RotateRect2f &rrect)#
Set the rotate rect object.
- Parameters:
rrect –
- Returns:
RotateRectRegion& this region.
-
const geometry::RotateRect2f &rotate_rect() const#
Get the rotate rectangle.
- Returns:
geometry::RotateRect2f const&
-
virtual geometry::Polygon2f polygon() const override#
Get the Polygon of segmentation region.
- Returns:
geometry::Polygon2f The Polygon of segmentation region.
-
inline virtual RotateRectRegion &set_name(const std::string &name) override#
Set the region name.
- Parameters:
name – Name of this region.
- Returns:
RotateRectRegion& This region.
-
inline virtual RotateRectRegion &set_score(float score) override#
Set the score of this region.
See also
- Parameters:
score – The region score.
- Returns:
RotateRectRegion& This region.
-
virtual geometry::Ring2f bounding_ring() const override#
Interface to get the outer_boundary of this region.
- Returns:
geometry::Ring2f The outer_boundary of this region.
-
virtual geometry::Radian angle() const override#
Interface to get the rotate_angle of this region.
- Returns:
geometry::Radian The rotate_angle of this region.
-
virtual float area() const override#
Get the area of this region.
- Returns:
float The area of this region.
-
virtual std::shared_ptr<IRegion> clone() const override#