Property Types#
-
class IProperty#
Subclassed by aidi::props::FeatureMap, aidi::props::IRegionList, aidi::props::Image, aidi::props::PolygonRegionList, aidi::props::RegionMatchResultList, aidi::props::ViewList
-
class Image : public aidi::props::IProperty#
Property Image.
Public Functions
-
Image(const aidi::Image &image, const aidi::RawImageInfo &raw_info)#
Construct a new Image object.
- Parameters:
image – aidi::Image image data.
raw_info – aidi::RawImageInfo raw image infomation.
-
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 aidi::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 aidi::Image::clone().
-
const aidi::Image &image() const#
Get image data.
- Returns:
NO_DISCARD const aidi::Image& image data.
-
const aidi::RawImageInfo &raw_info() const#
Get raw image infomation.
- Returns:
NO_DISCARD const aidi::RawImageInfo& raw image infomation.
-
Image &set_image(const aidi::Image &image)#
Set the image data.
- Parameters:
image – aidi::Image image data.
- Returns:
Image& reference to this object.
-
Image &set_raw_info(const aidi::RawImageInfo &raw_info)#
Set the raw image infomation.
- Parameters:
raw_info – Raw image infomation.
- Returns:
Image& reference to this object.
-
Image(const aidi::Image &image, const aidi::RawImageInfo &raw_info)#
-
class ViewList : public virtual aidi::props::IRegionList, public virtual aidi::props::IProperty#
Property ViewList contains multiple aidi::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 aidi::TaggedView in this ViewList.
- Returns:
size_t The number of aidi::TaggedView in this ViewList.
-
virtual std::vector<std::string> keys() const override#
Get all aidi::TaggedView IDs in this list.
- Returns:
std::vector<std::string> The IDs of all aidi::TaggedView in this list.
-
virtual const TaggedView &at(const std::string &view_key) const override#
Get the aidi::TaggedView at the given view ID.
- Parameters:
view_key – The ID of the aidi::TaggedView.
- Returns:
const TaggedView& The aidi::TaggedView reference at the given ID.
-
virtual bool contains(const std::string &view_key) const override#
Whether the aidi::TaggedView with the given ID exists in this viewlist.
- Parameters:
view_key – The ID of the aidi::TaggedView.
- Returns:
true The aidi::TaggedView with the given ID exists in this list.
- Returns:
false The aidi::TaggedView with the given ID does not exist in this list.
-
virtual void erase(const std::string &view_key) override#
Remove the aidi::TaggedView with the given ID. Nothing will be done if the ID is not found.
- Parameters:
view_key – The ID of the aidi::TaggedView to be removed.
-
Iterator erase(const Iterator &pos)#
Remove the aidi::TaggedView the Iterator refereced and return iterator to the next.
- Parameters:
pos – The Iterator of the aidi::TaggedView to be removed.
- Returns:
The Iterator to the aidi::TaggedView follows the removed view.
-
std::string add(const TaggedView &view)#
Add a new aidi::TaggedView instance into this list. An new id will be generated for the view added.
- Parameters:
view – The aidi::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 aidi::TaggedView into this list. If the ID already exists, fail to add and return false.
- Parameters:
it – The Iterator of the aidi::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 aidi::TaggedView specified by view_key with the new view. If view specified by view_key does not exist, the new aidi::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 aidi::TaggedView to be updated.
-
Iterator find(const std::string &view_key)#
Get iterator to aidi::TaggedView with id view_key.
- Parameters:
view_key – The id to be searched for.
- Returns:
Iterator The iterator to the aidi::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(const aidi::SplitTag &split_tag) const#
Get the specified split tag ViewList.
- Parameters:
split_tag – aidi::SplitTag split tag.
- Returns:
NO_DISCARD the specified split tag ViewList
-
std::vector<aidi::View> views() const#
Get the aidi::View corresponding to each aidi::TaggedView.
- Returns:
NO_DISCARD the aidi::View corresponding to each aidi::TaggedView.
-
using Iterator = std::map<std::string, TaggedView>::iterator#
-
struct IRegionList : public virtual aidi::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 aidi::props::PolygonRegionList, aidi::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 aidi::props::IRegionList, public virtual aidi::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.
-
virtual size_t size() const override#
-
class FeatureMap : public aidi::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 aidi::Image &feature_map)#
Insert feature map with label class name. The old feature map with same label class name will be replaced.
Note
The data in the aidi::Image will not be copied, Which means that if you modify the data content in the image later, the data in the inserted image will also be modified. If this is not the behavior you expect, you can call aidi::Image::clone() explicitly like below:
feature_map.insert("label-class", 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:
aidi::excepts::InvalidArgument – if the feature map if 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 aidi::Image &get(const std::string &label_class) const#
Get the feature map specified by the name.
See also
insert(const std::string &label_class, const aidi::Image &image) for more details.
Note
Do not modify the data in the image with out clone,
- Parameters:
label_class –
- Returns:
const aidi::Image & The reference of the feature map.
-
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 container.
-
void insert(const std::string &label_class, const aidi::Image &feature_map)#
-
class RegionMatchResultList : public aidi::props::IProperty#
Property to store list of RegionMatchResult.
Public Functions
-
const std::map<std::string, RegionMatchResult> >_infos() const#
Get all ground truth match results named with the regions’ key.
-
const std::map<std::string, RegionMatchResult> &pred_infos() const#
Get all match results for predicted regions named with the regions’ key.
-
std::map<std::string, RegionMatchResult> >_infos()#
Get all mutable ground truth match results.
-
std::map<std::string, RegionMatchResult> &pred_infos()#
Get all mutable match results for predicted regions.
-
const std::map<std::string, RegionMatchResult> >_infos() const#
Property Base Types#
-
class Image#
The Image class.
Only support uint8, uint16 and float32 datatype temporarily. And the data arrangement should be N * [HWC] (with [B,G,R] order if it’s a color image).
An Image may contains multiple visualizable images like png or jpeg, tiff, etc. And you need to make sure that all the visualizable images have the same height and width, otherwise some errors would occurred. This will only check when importing and exporting data.
Public Types
Public Functions
-
explicit Image(size_t visual_size = 0)#
Construct a new Image object.
- Parameters:
visual_size – Visualizable image number in the Image.
-
Image(size_t visual_size, uint32_t height, uint32_t width, uint32_t channels = 1, Depth depth = kDepthU8)#
Construct a new Image object.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
All the visualizable images have the same height, width, channels and depth.
-
Image(const Image &rhs)#
Copy constructor.
Only copy the data pointer, not the data. If you want to copy the data, you should use clone.
- Parameters:
rhs – other Image.
-
Image roi(uint32_t x, uint32_t y, uint32_t w, uint32_t h) const#
Get roi of Image.
Roi needs to be completely in Image, otherwise an excepts::InvalidArgument will be thrown.
- Parameters:
x – X-coordinate of top-left point, should be greater than 0 and less than Image width.
y – Y-coordinate of top-left point, should be greater than 0 and less than Image height.
w – Width of roi box, shoud be greater than 0 and less than or equal width - x.
h – Height of roi box, shoud be greater than 0 and less than or equal height - y.
- Throws:
excepts::DataNotFound – if Image is empty.
excepts::InvalidArgument – if bottom-right corner is out of range or if width or height isnot greater than 0.
- Returns:
-
Image roi(const geometry::Rect2i &rect) const#
Get roi of Image.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
geometry::Size2i size(size_t visual_index = 0) const#
The size of Image at [visual_index].
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image size. If visual_index out of visual_size an excepts::InvalidArgument will be thrown.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD geometry::Size2i.
-
void resize(const geometry::Size2i &size)#
Set size of Image.
This will resize all the visualizable images to target-width and target-height.
- Parameters:
size – geometry::Size2i, target-width and target-height.
- Throws:
excepts::DataNotFound – if Image is empty.
-
void resize(uint32_t width, uint32_t height)#
Set size of Image.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
void convert_channels(uint32_t channels)#
Convert channels of each visualizable image into target-channels.
Source-channels need to equal to 1, 3, or 4 and target-channels need to equal to 1 or 3, otherwise an excepts::InvalidArgument will be thrown.
- Parameters:
channels – Target-channels must be 1 or 3.
- Throws:
excepts::DataNotFound – if Image is empty.
excepts::InvalidArgument – if source-channels isnot equal to 1, 3, or 4 or target-channels isnot equal to 1 or 3.
-
void convert_depth(Depth depth)#
Convert depth of each visualizable image into target-depth.
- Parameters:
depth – Target-depth, oneof Depth.
- Throws:
excepts::DataNotFound – if Image is empty.
-
Image clone(int32_t visual_index = -1) const#
Deep copy.
If visual_index < -1 or visual_index out of visual_szie will throw an excepts::InvalidArgument.
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt -1 means clone all the visualizable images.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD cloned images.
-
Image visual_image(size_t visual_index = 0)#
Get visualizable image at [visual_index].
If visual_index out of visual_size will throw an excepts::InvalidArgument.
Warning
The return Image data is deep reference of this Image, that means this Image would be changed if you change the return Image data.
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD visualizable image at [visual_index].
-
void from_file(const std::string &path, int32_t flag = -1)#
Read a single image from file.
Only support from png, jpg/jpeg and tif/tiff, otherwise an excepts::FileNotFound will be thrown.
For tif file, you need to make sure that all the visualizable images have the same height and width, otherwise an excepts::InvalidArgument will be thrown.
- Parameters:
path – Image path.
flag – Refer to cv::ImreadModes
- Throws:
excepts::FileNotFound – if the file is empty or file isnot in the specified format.
excepts::DataNotFound – if a visualizable image in Image is empty.
excepts::InvalidArgument – if a visualizable image is diff in size form the first visualizable image.
-
void from_files(const std::vector<std::string> &path, int32_t flag = -1)#
Read multiple visualizable images from files.
See also
See also
- Parameters:
- Throws:
excepts::FileNotFound – if the path is empty.
-
void from_batch(const std::vector<Image> &batch_image)#
Read multiple Image.
This function will not copy the images data, if you want to run with deep copy, please call clone before or after. You need to make sure that all the visualizable images have the same height and width, otherwise an excepts::InvalidArgument will be thrown.
- Parameters:
batch_image – Multiple Image to be merged.
- Throws:
excepts::DataNotFound – if the batch_image have empty data.
excepts::InvalidArgument – if a visualizable image is diff in size form the first visualizable image.
-
void to_file(const std::string &path) const#
Save Image into file.
Image channels need to equal to 1, 3 or 4. For Image with visual_size greater than 1, only tif format storage is supported, and you need to make sure that all the visualizable images have the same height and width. For Image with visual_size equal to 1, it supports png, jpg and tif format storage. Otherwise an excepts::InvalidArgument will be thrown.
- Parameters:
path – File path where you want to save file.
- Throws:
excepts::DataNotFound – if Image is empty.
excepts::InvalidArgument – if Image channels isnot equal to 1, 3 or 4 or the storage format is incorrect or a visualizable image is diff in size form the first visualizable image.
-
void from_buf(const Buffer &inbuf, uint32_t height, uint32_t width, uint32_t channels = 1, Depth depth = kDepthU8)#
Parse image from Buffer.
Warning
This function doesenot support multiple visualizable images.
-
Buffer to_buf(size_t buf_size) const#
Reverse operation of from_buf.
This function dosenot support multiple visualizable images, otherwise an excepts::InvalidArgument will be thrown. If out buffer is shorter than data length, this function will not copy all data into buffer.
- Parameters:
buf_size – Byte size of pre-allocated buffer.
- Throws:
excepts::InvalidArgument – if Image visual_size isnot equal to 1.
- Returns:
NO_DISCARD out buffer.
-
Buffer dump() const#
Dump the Image into binary buffer.
Image channels need to equal to 1, 3 or 4. For Image with visual_size greater than 1, you need to make sure that all the visualizable images have the same height and width. Otherwise an excepts::InvalidArgument will be thrown.
- Throws:
excepts::DataNotFound – if Image is empty.
excepts::InvalidArgument – if Image channels isnot equal to 1, 3 or 4 or a visualizable image is diff in size form the first visualizable image.
- Returns:
NO_DISCARD the binary buffer.
-
void load(const Buffer &buffer)#
Load the Image from binary buffer.
you need to make sure that all the visualizable images have the same height and width, otherwise an excepts::InvalidArgument will be thrown.
- Parameters:
buffer – The binary buffer.
- Throws:
excepts::FileNotFound – if the file is empty.
excepts::DataNotFound – if a visualizable image in Image is empty.
excepts::InvalidArgument – if a visualizable image is diff in size form the first visualizable image.
-
const void *data(size_t visual_index = 0) const#
Readonly data pointer of visualizable image at [visual_index].
If visual_index out of visual_size will throw an excepts::InvalidArgument. If the visualizable image data isnot continuous will throw an excepts::LogicError.
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
excepts::LogicError – if the visualizable image isnot continuous.
- Returns:
NO_DISCARD readonly data pointer.
-
void *data(size_t visual_index = 0)#
Mutable data pointer of visualizable image at [visual_index].
If visual_index out of visual_size will throw an excepts::InvalidArgument. If the visualizable image data isnot continuous will throw an excepts::LogicError.
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
excepts::LogicError – if the visualizable image isnot continuous.
- Returns:
NO_DISCARD mutable data pointer.
-
size_t data_size(size_t visual_index = 0) const#
Data size of visualizable image at [visual_index].
Equal to height * width * channels.
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD data size.
-
size_t data_byte_size(size_t visual_index = 0) const#
Data byte size of visualizable image at [visual_index].
Equal to height * width * channels * element_size. Temporary, if depth is kDepthU8, its equal to data_size.
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD data byte size.
-
uint32_t height(size_t visual_index = 0) const#
Image height (rows) of visualizable image at [visual_index].
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD image height of visualizable image at [visual_index].
-
uint32_t width(size_t visual_index = 0) const#
Image width (clos) of visualizable image at [visual_index].
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD image width of visualizable image at [visual_index].
-
uint32_t channels(size_t visual_index = 0) const#
Image channels of visualizable image at [visual_index].
Usually its 1 (gray image) or 3 (BGR image).
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD image channels of visualizable image at [visual_index].
-
uint32_t total_channels() const#
Total Image channels.
Usually gray image channels is 1 and BGR image channels is 3. If this Image is multiple visualizable images, this function wll return total channels of all the visualizable images.
- Throws:
excepts::DataNotFound – if Image is empty.
- Returns:
NO_DISCARD total channels of all the visualizable images.
-
Depth depth(size_t visual_index = 0) const#
Image depth of visualizable image at [visual_index].
- Parameters:
visual_index – Index of visualizable images at [visual_index]. Defalt 0 means the first image.
- Throws:
excepts::InvalidArgument – if visual_index out of visual_size.
- Returns:
NO_DISCARD image depth of visualizable image at [visual_index].
-
bool empty() const#
Empty if Image is empty.
- Returns:
NO_DISCARD true if visual_size equal to 0 or a visualizable image is empty.
-
size_t visual_size() const#
Visual size.
- Returns:
NO_DISCARD visualizable image number in the Image.
-
bool is_multi_visual() const#
Is multi visual.
- Returns:
NO_DISCARD true if this Image have multiple visualizable images.
-
void release()#
Release image data.
-
class RawImageInfo#
Raw image infomation.
Public Functions
-
RawImageInfo()#
Construct a new RawImageInfo object by default.
-
explicit RawImageInfo(const std::string &file_path, bool from_camera = false, int64_t import_time = 0)#
Constructor with file path, camera id, and import time.
- Parameters:
file_path – File path. If from_camera is true, file_path means camera id.
from_camera – Whether the image is from camera. Default is false, which means from file.
import_time – Import time. If import time is 0 (As default), it will be set to the current time.
-
RawImageInfo(const RawImageInfo &rhs)#
Deep copy constructor.
It will not share the same references as the source object.
- Parameters:
rhs – Other RawImageInfo.
-
RawImageInfo &operator=(const RawImageInfo &rhs)#
Assignment operator.
- Parameters:
rhs – Other RawImageInfo.
- Returns:
RawImageInfo& reference to this object.
-
RawImageInfo(RawImageInfo &&rhs) noexcept#
Move constructor.
- Parameters:
rhs – Other rvalue RawImageInfo.
-
RawImageInfo &operator=(RawImageInfo &&rhs) noexcept#
Move assignment operator.
- Parameters:
rhs – Other rvalue RawImageInfo.
- Returns:
RawImageInfo& reference to this object.
-
const std::string &file_path() const#
Get image file path.
- Returns:
const std::string& if from_camera() is false, return the file path.
-
const std::string &camera_id() const#
Get image camera id.
- Returns:
const std::string& if from_camera() is true, return the camera id.
-
bool from_camera() const#
Get whether the image is from camera.
- Returns:
NO_DISCARD true for camera, false for file.
-
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()#
-
class View#
View after matrix transformation.
Subclassed by aidi::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 aidi::SplitTag#
Split tag for the View.
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:
aidi::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:
aidi::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 aidi::View, public aidi::IRegion#
View with split tag.
Public Functions
-
TaggedView()#
Construct a new TaggedView object by default.
-
explicit TaggedView(const View &view, const 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 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(const SplitTag &split_tag)#
Set the split tag.
- Parameters:
split_tag – SplitTag.
- Returns:
TaggedView& reference to this object.
-
TaggedView()#
-
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 aidi::PolygonRegion, aidi::TaggedView
Public Functions
-
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.
-
virtual geometry::Polygon2f polygon() const = 0#
-
class PolygonRegion : public aidi::IRegion#
Label Region descriped with polygon, generally used for segmentation.
Public Functions
-
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.
-
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.
-
PolygonRegion &set_polygon(const geometry::Polygon2f &polygon)#
-
struct RegionMatchResult#
The region match result information output by the regions match operator. Each one of this structure represents a matching result for a region in the ground truth or the predictions.
Public Members
-
bool is_match = false#
If this region matches its best matching region. This field should false if the best_match is empty.
-
std::string best_match = {}#
The best matched region key. If this region is a ground truth, the best match should be in the predicted regions, vice versa. It will be an empty string If there are no regions matching this region.
Note
It’s not means that this region is matched with the best_batched region if this field is not empty, because there may be other region that is more suitable for matching the best_batched region of this region. The only way to know if this region matches its best matching region is the is_match field.
-
float iou#
The IoU value between this region and its best matched region. It should be 0 if not matched.
-
bool is_match = false#