!16577 Update MindData cpp api doc

From: @luoyang42
Reviewed-by: @robingrosman
Signed-off-by: @robingrosman
This commit is contained in:
mindspore-ci-bot 2021-05-24 09:21:50 +08:00 committed by Gitee
commit 01e0b65da0
10 changed files with 665 additions and 600 deletions

View File

@ -1,5 +1,5 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
* Copyright 2020-2021 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -72,7 +72,7 @@ int32_t get_callback_timeout();
/// \brief Function to load configuration from a file.
/// \param[in] file path of the configuration file to be loaded.
/// \note This api exists because std::string will constrained by ABI compile macro but char don't.
/// \note This API exists because std::string will constrained by ABI compile option while char don't.
bool load(const std::vector<char> &file);
/// \brief Function to load configuration from a file.

View File

@ -26,43 +26,43 @@ namespace dataset {
using uchar = unsigned char;
using dsize_t = int64_t;
// Target devices to perform map operation
/// \brief Target devices to perform map operation
enum class MapTargetDevice { kCpu, kGpu, kAscend310 };
// Possible dataset types for holding the data and client type
/// \brief Possible dataset types for holding the data and client type
enum class DatasetType { kUnknown, kArrow, kTf };
// Possible flavours of Tensor implementations
/// \brief Possible flavours of Tensor implementations
enum class TensorImpl { kNone, kFlexible, kCv, kNP };
// Possible values for shuffle
/// \brief Possible values for shuffle
enum class ShuffleMode { kFalse = 0, kFiles = 1, kGlobal = 2, kInfile = 3 };
// Possible values for Border types
/// \brief Possible values for Border types
enum class BorderType { kConstant = 0, kEdge = 1, kReflect = 2, kSymmetric = 3 };
// Possible values for Image format types in a batch
/// \brief Possible values for Image format types in a batch
enum class ImageBatchFormat { kNHWC = 0, kNCHW = 1 };
// Possible values for Image format types
/// \brief Possible values for Image format types
enum class ImageFormat { HWC = 0, CHW = 1, HW = 2 };
// Possible interpolation modes
/// \brief Possible interpolation modes
enum class InterpolationMode { kLinear = 0, kNearestNeighbour = 1, kCubic = 2, kArea = 3, kCubicPil = 4 };
// Possible JiebaMode modes
/// \brief Possible JiebaMode modes
enum class JiebaMode { kMix = 0, kMp = 1, kHmm = 2 };
// Possible values for SPieceTokenizerOutType
/// \brief Possible values for SPieceTokenizerOutType
enum class SPieceTokenizerOutType { kString = 0, kInt = 1 };
// Possible values for SPieceTokenizerLoadType
/// \brief Possible values for SPieceTokenizerLoadType
enum class SPieceTokenizerLoadType { kFile = 0, kModel = 1 };
// Possible values for SentencePieceModel
/// \brief Possible values for SentencePieceModel
enum class SentencePieceModel { kUnigram = 0, kBpe = 1, kChar = 2, kWord = 3 };
// Possible values for NormalizeForm
/// \brief Possible values for NormalizeForm
enum class NormalizeForm {
kNone = 0,
kNfc,
@ -71,7 +71,7 @@ enum class NormalizeForm {
kNfkd,
};
// Possible values for Mask
/// \brief Possible values for Mask
enum class RelationalOp {
kEqual = 0, // ==
kNotEqual, // !=
@ -81,7 +81,7 @@ enum class RelationalOp {
kGreaterEqual, // >=
};
// Possible values for SamplingStrategy
/// \brief Possible values for SamplingStrategy
enum class SamplingStrategy { kRandom = 0, kEdgeWeight = 1 };
// convenience functions for 32bit int bitmask

File diff suppressed because it is too large Load Diff

View File

@ -32,38 +32,74 @@ class DeviceResource;
// class to run tensor operations in eager mode
class Execute {
public:
/// \brief Constructor
// FIXME - Temporarily overload Execute to support both TensorOperation and TensorTransform
/// \brief Constructor.
/// \param[in] op TensorOperation to be applied in Eager mode, it accepts op in type of shared pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(std::shared_ptr<TensorOperation> op, MapTargetDevice deviceType = MapTargetDevice::kCpu,
uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] op TensorTransform to be applied in Eager mode, it accepts op in type of shared pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(std::shared_ptr<TensorTransform> op, MapTargetDevice deviceType = MapTargetDevice::kCpu,
uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] op TensorTransform to be applied in Eager mode, it accepts op in type of reference.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(std::reference_wrapper<TensorTransform> op, MapTargetDevice deviceType = MapTargetDevice::kCpu,
uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] op TensorTransform to be applied in Eager mode, it accepts op in type of raw pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(TensorTransform *op, MapTargetDevice deviceType = MapTargetDevice::kCpu, uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] ops A vector of TensorOperations to be applied in Eager mode, it accepts op in type of shared pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(std::vector<std::shared_ptr<TensorOperation>> ops,
MapTargetDevice deviceType = MapTargetDevice::kCpu, uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] ops A vector of TensorTransforms to be applied in Eager mode, it accepts op in type of shared pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(std::vector<std::shared_ptr<TensorTransform>> ops,
MapTargetDevice deviceType = MapTargetDevice::kCpu, uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] ops A vector of TensorTransforms to be applied in Eager mode, it accepts op in type of raw pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(const std::vector<std::reference_wrapper<TensorTransform>> ops,
MapTargetDevice deviceType = MapTargetDevice::kCpu, uint32_t device_id = 0);
/// \brief Constructor.
/// \param[in] ops A vector of TensorTransforms to be applied in Eager mode, it accepts op in type of raw pointer.
/// \param[in] deviceType Target device env to perform operation, can be kCPU/kGPU/kAscend310 (default=kCPU).
/// \param[in] device_id Target device id to perform operation, only valid when deviceType=kAscend310 (default=0).
explicit Execute(const std::vector<TensorTransform *> &ops, MapTargetDevice deviceType = MapTargetDevice::kCpu,
uint32_t device_id = 0);
/// \brief Destructor
/// \brief Destructor.
~Execute();
/// \brief callable function to execute the TensorOperation in eager mode
/// \param[in] input Tensor to be transformed
/// \param[out] output Transformed tensor
/// \return Status code
/// \brief Callable function to execute the TensorTransform in eager mode.
/// \param[in] input Tensor to be transformed.
/// \param[out] output Transformed tensor.
/// \return Status error code, returns OK if no error encountered.
Status operator()(const mindspore::MSTensor &input, mindspore::MSTensor *output);
/// \brief callable function to execute the TensorOperation in eager mode
/// \param[in] input_tensor_list List of Tensor to be transformed
/// \param[out] out Result tensor after transform
/// \return - Status
/// \brief Callable function to execute the TensorTransform in eager mode.
/// \param[in] input_tensor_list List of Tensor to be transformed.
/// \param[out] out Result tensor after transform.
/// \return Status error code, returns OK if no error encountered.
Status operator()(const std::vector<mindspore::MSTensor> &input_tensor_list, std::vector<mindspore::MSTensor> *out);
Status DeviceMemoryRelease();

View File

@ -56,13 +56,13 @@ class Iterator {
/// \brief Method for building and launching the pipeline.
/// \param[in] ops - a vector of DatasetOp in the data pipeline.
/// \param[in] num_epochs Number of epochs passed down to EpochCtrlNode, default -1, infinite epochs
/// \return - a Status error code, returns OK if no error encountered.
/// \return Status error code, returns OK if no error encountered.
Status BuildAndLaunchTree(std::shared_ptr<Dataset> ds, int32_t num_epochs);
/// \brief Function to get the next row from the data pipeline.
/// \note Type of return data is a map(with column name).
/// \param[out] row - the output tensor row.
/// \return - a Status error code, returns OK if no error encountered.
/// \return Status error code, returns OK if no error encountered.
Status GetNextRow(MSTensorMap *row) {
MSTensorMapChar row_;
row_.clear();
@ -73,13 +73,13 @@ class Iterator {
}
// Char interface(CharIF) of GetNextRow
// This api exists because std::string will constrained by ABI compile macro but char don't.
// This This API exists because std::string will constrained by ABI compile option while char don't.
Status GetNextRowCharIF(MSTensorMapChar *row);
/// \brief Function to get the next row from the data pipeline.
/// \note Type of return data is a vector(without column name).
/// \param[out] row - the output tensor row.
/// \return - a Status error code, returns OK if no error encountered.
/// \return Status error code, returns OK if no error encountered.
virtual Status GetNextRow(MSTensorVec *row);
/// \brief Function to shut down the data pipeline.
@ -127,22 +127,22 @@ class PullIterator : public Iterator {
/// \brief Function to get next row from the data pipeline.
/// \note Type of return data is a vector(without column name).
/// \param[out] row - the output tensor row.
/// \return Returns true if no error encountered else false.
/// \param[out] row The output tensor row.
/// \return Status error code, returns OK if no error encountered else false.
Status GetNextRow(MSTensorVec *const row) override;
/// \brief Function to get specified rows from the data pipeline.
/// \note Type of return data is a vector(without column name).
/// \note This behavior is subject to change
/// \param[in] num_rows - the number of rows to fetch.
/// \param[out] row - the output tensor row.
/// \return Returns true if no error encountered else false.
/// \param[in] num_rows The number of rows to fetch.
/// \param[out] row The output tensor row.
/// \return Status error code, returns OK if no error encountered else false.
Status GetRows(int32_t num_rows, std::vector<MSTensorVec> *const row);
/// \brief Method for building and launching the pipeline.
/// \note Consider making this function protected.
/// \param[in] ds - The root node that calls the function
/// \return - a Status error code, returns OK if no error encountered.
/// \return Status error code, returns OK if no error encountered.
Status BuildAndLaunchTree(std::shared_ptr<Dataset> ds);
private:

View File

@ -67,19 +67,19 @@ class Sampler : std::enable_shared_from_this<Sampler> {
};
/// \brief A class to represent a Distributed Sampler in the data pipeline.
/// \notes A Sampler that accesses a shard of the dataset.
/// \note A Sampler that accesses a shard of the dataset.
class DistributedSampler final : public Sampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] num_shards - Number of shards to divide the dataset into.
/// \param[in] shard_id - Shard ID of the current shard within num_shards.
/// \param[in] shuffle - If true, the indices are shuffled.
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] seed - The seed in use when shuffle is true.
/// \param[in] offset - The starting position where access to elements in the dataset begins.
/// \param[in] even_dist - If true, each shard would return the same number of rows (default to true).
/// \param[in] num_shards Number of shards to divide the dataset into.
/// \param[in] shard_id Shard ID of the current shard within num_shards.
/// \param[in] shuffle If true, the indices are shuffled (default=true).
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
/// \param[in] seed The seed in use when shuffle is true (default=1).
/// \param[in] offset The starting position where access to elements in the dataset begins (default=-1).
/// \param[in] even_dist If true, each shard would return the same number of rows (default=true).
/// If false the total rows returned by all the shards would not have overlap.
explicit DistributedSampler(int64_t num_shards, int64_t shard_id, bool shuffle = true, int64_t num_samples = 0,
uint32_t seed = 1, int64_t offset = -1, bool even_dist = true);
@ -102,16 +102,16 @@ class DistributedSampler final : public Sampler {
};
/// \brief A class to represent a PK Sampler in the data pipeline.
/// \notes Samples K elements for each P class in the dataset.
/// \note Samples K elements for each P class in the dataset.
/// This will sample all classes.
class PKSampler final : public Sampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] num_val - Number of elements to sample for each class.
/// \param[in] shuffle - If true, the class IDs are shuffled.
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] num_val Number of elements to sample for each class.
/// \param[in] shuffle If true, the class IDs are shuffled (default=false).
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
explicit PKSampler(int64_t num_val, bool shuffle = false, int64_t num_samples = 0);
/// \brief Destructor.
@ -129,14 +129,14 @@ class PKSampler final : public Sampler {
};
/// \brief A class to represent a Random Sampler in the data pipeline.
/// \notes Samples the elements randomly.
/// \note Samples the elements randomly.
class RandomSampler final : public Sampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] replacement - If true, put the sample ID back for the next draw.
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] replacement If true, put the sample ID back for the next draw (default=false).
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
explicit RandomSampler(bool replacement = false, int64_t num_samples = 0);
/// \brief Destructor.
@ -153,14 +153,14 @@ class RandomSampler final : public Sampler {
};
/// \brief A class to represent a Sequential Sampler in the data pipeline.
/// \notes Samples the dataset elements sequentially, same as not having a sampler.
/// \note Samples the dataset elements sequentially, same as not having a sampler.
class SequentialSampler final : public Sampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] start_index - Index to start sampling at (default to start at first id).
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] start_index Index to start sampling at (default=0, start at first id).
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
explicit SequentialSampler(int64_t start_index = 0, int64_t num_samples = 0);
/// \brief Destructor.
@ -177,14 +177,14 @@ class SequentialSampler final : public Sampler {
};
/// \brief A class to represent a Subset Sampler in the data pipeline.
/// \notes Samples the elements from a sequence of indices.
/// \note Samples the elements from a sequence of indices.
class SubsetSampler : public Sampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] indices - A vector sequence of indices.
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] indices A vector sequence of indices.
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
explicit SubsetSampler(std::vector<int64_t> indices, int64_t num_samples = 0);
/// \brief Destructor.
@ -200,14 +200,14 @@ class SubsetSampler : public Sampler {
};
/// \brief A class to represent a Subset Random Sampler in the data pipeline.
/// \notes Samples the elements randomly from a sequence of indices.
/// \note Samples the elements randomly from a sequence of indices.
class SubsetRandomSampler final : public SubsetSampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] indices - A vector sequence of indices.
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] indices A vector sequence of indices.
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
explicit SubsetRandomSampler(std::vector<int64_t> indices, int64_t num_samples = 0);
/// \brief Destructor.
@ -220,16 +220,16 @@ class SubsetRandomSampler final : public SubsetSampler {
};
/// \brief A class to represent a Weighted Random Sampler in the data pipeline.
/// \notes Samples the elements from [0, len(weights) - 1] randomly with the given
/// \note Samples the elements from [0, len(weights) - 1] randomly with the given
/// weights (probabilities).
class WeightedRandomSampler final : public Sampler {
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
public:
/// \brief Constructor
/// \param[in] weights - A vector sequence of weights, not necessarily summing up to 1.
/// \param[in] num_samples - The number of samples to draw (default to all elements).
/// \param[in] replacement - If true, put the sample ID back for the next draw.
/// \param[in] weights A vector sequence of weights, not necessarily summing up to 1.
/// \param[in] num_samples The number of samples to draw (default=0, return all samples).
/// \param[in] replacement If true, put the sample ID back for the next draw (default=true).
explicit WeightedRandomSampler(std::vector<double> weights, int64_t num_samples = 0, bool replacement = true);
/// \brief Destructor.

View File

@ -40,11 +40,11 @@ namespace text {
#ifndef _WIN32
/// \brief Tokenize a scalar tensor of UTF-8 string by specific rules.
/// \notes BasicTokenizer is not supported on Windows platform yet.
/// \note BasicTokenizer is not supported on Windows platform yet.
class BasicTokenizer final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] lower_case If true, apply CaseFold, NormalizeUTF8(NFD mode), RegexReplace operation on input text to
/// \param[in] lower_case If true, apply CaseFold, NormalizeUTF8 (NFD mode), RegexReplace operation on input text to
/// fold the text to lower case and strip accents characters. If false, only apply
/// NormalizeUTF8('normalization_form' mode) operation on input text (default=false).
/// \param[in] keep_whitespace If true, the whitespace will be kept in out tokens (default=false).
@ -71,7 +71,7 @@ class BasicTokenizer final : public TensorTransform {
};
/// \brief Tokenizer used for Bert text process.
/// \notes BertTokenizer is not supported on Windows platform yet.
/// \note BertTokenizer is not supported on Windows platform yet.
class BertTokenizer final : public TensorTransform {
public:
/// \brief Constructor.
@ -80,7 +80,7 @@ class BertTokenizer final : public TensorTransform {
/// \param[in] max_bytes_per_token Tokens exceeding this length will not be further split (default=100).
/// \param[in] unknown_token When a token cannot be found, return the token directly if 'unknown_token' is an empty
/// string, else return the string specified(default='[UNK]').
/// \param[in] lower_case If true, apply CaseFold, NormalizeUTF8(NFD mode), RegexReplace operation on input text to
/// \param[in] lower_case If true, apply CaseFold, NormalizeUTF8 (NFD mode), RegexReplace operation on input text to
/// fold the text to lower case and strip accents characters. If false, only apply
/// NormalizeUTF8('normalization_form' mode) operation on input text (default=false).
/// \param[in] keep_whitespace If true, the whitespace will be kept in out tokens (default=false).
@ -127,13 +127,13 @@ class CaseFold final : public TensorTransform {
protected:
/// \brief Function to convert TensorTransform object into a TensorOperation object.
//// \return Shared pointer to TensorOperation object.
/// \return Shared pointer to TensorOperation object.
std::shared_ptr<TensorOperation> Parse() override;
};
#endif
/// \brief Tokenize Chinese string into words based on dictionary.
/// \notes The integrity of the HMMSEgment algorithm and MPSegment algorithm files must be confirmed.
/// \note The integrity of the HMMSEgment algorithm and MPSegment algorithm files must be confirmed.
class JiebaTokenizer final : public TensorTransform {
public:
/// \brief Constructor.
@ -161,10 +161,12 @@ class JiebaTokenizer final : public TensorTransform {
/// The added word will not be written into the built-in dictionary on disk.
/// \param[in] freq The frequency of the word to be added. The higher the frequency,
/// the better chance the word will be tokenized (default=None, use default frequency).
/// \return Status error code, returns OK if no error encountered.
Status AddWord(const std::string &word, int64_t freq = 0) { return AddWordChar(StringToChar(word), freq); }
/// \brief Add user defined dictionary of word-freq pairs to JiebaTokenizer's dictionary.
/// \param[in] user_dict Vector of word-freq pairs to be added to JiebaTokenizer's dictionary.
/// \return Status error code, returns OK if no error encountered.
Status AddDict(const std::vector<std::pair<std::string, int64_t>> &user_dict) {
return AddDictChar(PairStringInt64ToPairCharInt64(user_dict));
}
@ -173,6 +175,7 @@ class JiebaTokenizer final : public TensorTransform {
/// Only valid word-freq pairs in user provided file will be added into the dictionary.
/// Rows containing invalid input will be ignored, no error nor warning Status is returned.
/// \param[in] file_path Path to the dictionary which includes user defined word-freq pairs.
/// \return Status error code, returns OK if no error encountered.
Status AddDict(const std::string &file_path) { return AddDictChar(StringToChar(file_path)); }
protected:
@ -322,7 +325,7 @@ class RegexTokenizer final : public TensorTransform {
/// \brief Constructor.
/// \param[in] delim_pattern The pattern of regex delimiters.
/// \param[in] keep_delim_pattern The string matched by 'delim_pattern' can be kept as a token if it can be
/// matched by 'keep_delim_pattern'. The default value is an empty string ("")
/// matched by 'keep_delim_pattern'. The default value is an empty string ("").
/// which means that delimiters will not be kept as an output token (default="").
/// \param[in] with_offsets Whether or not output offsets of tokens (default=false).
explicit RegexTokenizer(std::string delim_pattern, std::string keep_delim_pattern = "", bool with_offsets = false)

View File

@ -128,7 +128,7 @@ class SliceOption {
namespace transforms {
/// \brief Compose Op.
/// \notes Compose a list of transforms into a single transform.
/// \note Compose a list of transforms into a single transform.
class Compose final : public TensorTransform {
public:
/// \brief Constructor.
@ -155,7 +155,7 @@ class Compose final : public TensorTransform {
};
/// \brief Concatenate Op.
/// \notes Tensor operation that concatenates all columns into a single tensor.
/// \note Tensor operation that concatenates all columns into a single tensor.
class Concatenate final : public TensorTransform {
public:
/// \brief Constructor.
@ -178,7 +178,7 @@ class Concatenate final : public TensorTransform {
};
/// \brief Duplicate Op.
/// \notes Duplicate the input tensor to a new output tensor.
/// \note Duplicate the input tensor to a new output tensor.
/// The input tensor is carried over to the output list.
class Duplicate final : public TensorTransform {
public:
@ -195,7 +195,7 @@ class Duplicate final : public TensorTransform {
};
/// \brief Fill Op.
/// \notes Tensor operation to fill all elements in the tensor with the specified value.
/// \note Tensor operation to fill all elements in the tensor with the specified value.
/// The output tensor will have the same shape and type as the input tensor.
class Fill final : public TensorTransform {
public:
@ -219,7 +219,7 @@ class Fill final : public TensorTransform {
};
/// \brief Mask Op.
/// \notes Mask content of the input tensor with the given predicate.
/// \note Mask content of the input tensor with the given predicate.
/// Any element of the tensor that matches the predicate will be evaluated to True, otherwise False.
class Mask final : public TensorTransform {
public:
@ -246,7 +246,7 @@ class Mask final : public TensorTransform {
};
/// \brief OneHot Op.
/// \notes Convert the labels into OneHot format.
/// \note Convert the labels into OneHot format.
class OneHot final : public TensorTransform {
public:
/// \brief Constructor.
@ -267,7 +267,7 @@ class OneHot final : public TensorTransform {
};
/// \brief PadEnd Op.
/// \notes Pad input tensor according to pad_shape, need to have same rank.
/// \note Pad input tensor according to pad_shape, need to have same rank.
class PadEnd final : public TensorTransform {
public:
/// \brief Constructor.
@ -291,20 +291,20 @@ class PadEnd final : public TensorTransform {
};
/// \brief RandomApply Op.
/// \notes Randomly perform a series of transforms with a given probability.
/// \note Randomly perform a series of transforms with a given probability.
class RandomApply final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] transforms A vector of raw pointers to TensorTransform objects to be applied.
/// \param[in] prob The probability to apply the transformation list (default=0.5)
/// \param[in] prob The probability to apply the transformation list (default=0.5).
explicit RandomApply(const std::vector<TensorTransform *> &transforms, double prob = 0.5);
/// \brief Constructor.
/// \param[in] transforms A vector of shared pointers to TensorTransform objects to be applied.
/// \param[in] prob The probability to apply the transformation list (default=0.5)
/// \param[in] prob The probability to apply the transformation list (default=0.5).
explicit RandomApply(const std::vector<std::shared_ptr<TensorTransform>> &transforms, double prob = 0.5);
/// \brief Constructor.
/// \param[in] transforms A vector of TensorTransform objects to be applied.
/// \param[in] prob The probability to apply the transformation list (default=0.5)
/// \param[in] prob The probability to apply the transformation list (default=0.5).
explicit RandomApply(const std::vector<std::reference_wrapper<TensorTransform>> &transforms, double prob = 0.5);
/// \brief Destructor
@ -321,7 +321,7 @@ class RandomApply final : public TensorTransform {
};
/// \brief RandomChoice Op.
/// \notes Randomly selects one transform from a list of transforms to perform operation.
/// \note Randomly selects one transform from a list of transforms to perform operation.
class RandomChoice final : public TensorTransform {
public:
/// \brief Constructor.
@ -348,7 +348,7 @@ class RandomChoice final : public TensorTransform {
};
/// \brief Slice Op.
/// \notes Slice operation to extract a tensor out using the given n slices.
/// \note Slice operation to extract a tensor out using the given n slices.
/// The functionality of Slice is similar to NumPy's indexing feature.
/// (Currently only rank-1 tensors are supported).
class Slice final : public TensorTransform {
@ -371,7 +371,7 @@ class Slice final : public TensorTransform {
};
/// \brief TypeCast Op.
/// \notes Tensor operation to cast to a given MindSpore data type.
/// \note Tensor operation to cast to a given MindSpore data type.
class TypeCast final : public TensorTransform {
public:
/// \brief Constructor.
@ -392,7 +392,7 @@ class TypeCast final : public TensorTransform {
};
/// \brief Unique Op.
/// \notes Return an output tensor containing all the unique elements of the input tensor in
/// \note Return an output tensor containing all the unique elements of the input tensor in
/// the same order that they occur in the input tensor.
class Unique final : public TensorTransform {
public:

View File

@ -37,7 +37,7 @@ class TensorOperation;
// Transform operations for performing computer vision.
namespace vision {
/// \brief AutoContrast TensorTransform.
/// \notes Apply automatic contrast on input image.
/// \note Apply automatic contrast on input image.
class AutoContrast final : public TensorTransform {
public:
/// \brief Constructor.
@ -59,7 +59,7 @@ class AutoContrast final : public TensorTransform {
};
/// \brief BoundingBoxAugment TensorTransform.
/// \notes Apply a given image transform on a random selection of bounding box regions of a given image.
/// \note Apply a given image transform on a random selection of bounding box regions of a given image.
class BoundingBoxAugment final : public TensorTransform {
public:
/// \brief Constructor.
@ -90,15 +90,15 @@ class BoundingBoxAugment final : public TensorTransform {
std::shared_ptr<Data> data_;
};
/// \brief Constructor to apply CutMix on a batch of images
/// \notes Masks a random section of each image with the corresponding part of another randomly
/// selected image in that batch
/// \brief Constructor to apply CutMix on a batch of images.
/// \note Masks a random section of each image with the corresponding part of another randomly
/// selected image in that batch.
class CutMixBatch final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] image_batch_format The format of the batch
/// \param[in] alpha The hyperparameter of beta distribution (default = 1.0)
/// \param[in] prob The probability by which CutMix is applied to each image (default = 1.0)
/// \param[in] image_batch_format The format of the batch.
/// \param[in] alpha The hyperparameter of beta distribution (default = 1.0).
/// \param[in] prob The probability by which CutMix is applied to each image (default = 1.0).
explicit CutMixBatch(ImageBatchFormat image_batch_format, float alpha = 1.0, float prob = 1.0);
/// \brief Destructor.
@ -114,13 +114,13 @@ class CutMixBatch final : public TensorTransform {
std::shared_ptr<Data> data_;
};
/// \brief CutOut TensorOp
/// \notes Randomly cut (mask) out a given number of square patches from the input image
/// \brief CutOut TensorOp.
/// \note Randomly cut (mask) out a given number of square patches from the input image.
class CutOut final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] length Integer representing the side length of each square patch
/// \param[in] num_patches Integer representing the number of patches to be cut out of an image
/// \param[in] length Integer representing the side length of each square patch.
/// \param[in] num_patches Integer representing the number of patches to be cut out of an image.
explicit CutOut(int32_t length, int32_t num_patches = 1);
/// \brief Destructor.
@ -137,7 +137,7 @@ class CutOut final : public TensorTransform {
};
/// \brief Equalize TensorTransform.
/// \notes Apply histogram equalization on input image.
/// \note Apply histogram equalization on input image.
class Equalize final : public TensorTransform {
public:
/// \brief Constructor.
@ -153,7 +153,7 @@ class Equalize final : public TensorTransform {
};
/// \brief HwcToChw TensorTransform.
/// \notes Transpose the input image; shape (H, W, C) to shape (C, H, W).
/// \note Transpose the input image; shape (H, W, C) to shape (C, H, W).
class HWC2CHW final : public TensorTransform {
public:
/// \brief Constructor.
@ -169,7 +169,7 @@ class HWC2CHW final : public TensorTransform {
};
/// \brief Invert TensorTransform.
/// \notes Apply invert on input image in RGB mode.
/// \note Apply invert on input image in RGB mode.
class Invert final : public TensorTransform {
public:
/// \brief Constructor.
@ -185,12 +185,12 @@ class Invert final : public TensorTransform {
};
/// \brief MixUpBatch TensorTransform.
/// \notes Apply MixUp transformation on an input batch of images and labels. The labels must be in
/// \note Apply MixUp transformation on an input batch of images and labels. The labels must be in
/// one-hot format and Batch must be called before calling this function.
class MixUpBatch final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] alpha hyperparameter of beta distribution (default = 1.0)
/// \param[in] alpha hyperparameter of beta distribution (default = 1.0).
explicit MixUpBatch(float alpha = 1);
/// \brief Destructor.
@ -207,7 +207,7 @@ class MixUpBatch final : public TensorTransform {
};
/// \brief NormalizePad TensorTransform.
/// \notes Normalize the input image with respect to mean and standard deviation and pad an extra
/// \note Normalize the input image with respect to mean and standard deviation and pad an extra
/// channel with value zero.
class NormalizePad final : public TensorTransform {
public:
@ -215,9 +215,9 @@ class NormalizePad final : public TensorTransform {
/// \param[in] mean A vector of mean values for each channel, w.r.t channel order.
/// The mean values must be in range [0.0, 255.0].
/// \param[in] std A vector of standard deviations for each channel, w.r.t. channel order.
/// The standard deviation values must be in range (0.0, 255.0]
/// The standard deviation values must be in range (0.0, 255.0].
/// \param[in] dtype The output datatype of Tensor.
/// The standard deviation values must be "float32" or "float16"default = "float32"
/// The standard deviation values must be "float32" or "float16"default = "float32".
explicit NormalizePad(const std::vector<float> &mean, const std::vector<float> &std,
const std::string &dtype = "float32")
: NormalizePad(mean, std, StringToChar(dtype)) {}
@ -237,8 +237,8 @@ class NormalizePad final : public TensorTransform {
std::shared_ptr<Data> data_;
};
/// \brief Pad TensorOp
/// \notes Pads the image according to padding parameters
/// \brief Pad TensorOp.
/// \note Pads the image according to padding parameters.
class Pad final : public TensorTransform {
public:
/// \brief Constructor.
@ -251,7 +251,7 @@ class Pad final : public TensorTransform {
/// \param[in] fill_value A vector representing the pixel intensity of the borders if the padding_mode is
/// BorderType.kConstant. If 1 value is provided, it is used for all RGB channels. If 3 values are provided,
/// it is used to fill R, G, B channels respectively.
/// \param[in] padding_mode The method of padding (default=BorderType.kConstant)
/// \param[in] padding_mode The method of padding (default=BorderType.kConstant).
/// Can be any of
/// [BorderType.kConstant, BorderType.kEdge, BorderType.kReflect, BorderType.kSymmetric]
/// - BorderType.kConstant, means it fills the border with constant values
@ -276,12 +276,12 @@ class Pad final : public TensorTransform {
/// \brief Blends an image with its grayscale version with random weights
/// t and 1 - t generated from a given range. If the range is trivial
/// then the weights are determinate and t equals the bound of the interval
/// then the weights are determinate and t equals the bound of the interval.
class RandomColor final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] t_lb Lower bound on the range of random weights
/// \param[in] t_lb Upper bound on the range of random weights
/// \param[in] t_lb Lower bound on the range of random weights.
/// \param[in] t_lb Upper bound on the range of random weights.
explicit RandomColor(float t_lb, float t_ub);
/// \brief Destructor.
@ -298,19 +298,19 @@ class RandomColor final : public TensorTransform {
};
/// \brief RandomColorAdjust TensorTransform.
/// \brief Randomly adjust the brightness, contrast, saturation, and hue of the input image
/// \brief Randomly adjust the brightness, contrast, saturation, and hue of the input image.
class RandomColorAdjust final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] brightness Brightness adjustment factor. Must be a vector of one or two values
/// if it's a vector of two values it needs to be in the form of [min, max]. Default value is {1, 1}
/// if it's a vector of two values it needs to be in the form of [min, max] (Default={1, 1}).
/// \param[in] contrast Contrast adjustment factor. Must be a vector of one or two values
/// if it's a vector of two values it needs to be in the form of [min, max]. Default value is {1, 1}
/// if it's a vector of two values it needs to be in the form of [min, max] (Default={1, 1}).
/// \param[in] saturation Saturation adjustment factor. Must be a vector of one or two values
/// if it's a vector of two values it needs to be in the form of [min, max]. Default value is {1, 1}
/// if it's a vector of two values it needs to be in the form of [min, max] (Default={1, 1}).
/// \param[in] hue Brightness adjustment factor. Must be a vector of one or two values
/// if it's a vector of two values it must be in the form of [min, max] where -0.5 <= min <= max <= 0.5
/// Default value is {0, 0}
/// (Default={0, 0}).
explicit RandomColorAdjust(std::vector<float> brightness = {1.0, 1.0}, std::vector<float> contrast = {1.0, 1.0},
std::vector<float> saturation = {1.0, 1.0}, std::vector<float> hue = {0.0, 0.0});
@ -328,7 +328,7 @@ class RandomColorAdjust final : public TensorTransform {
};
/// \brief RandomCrop TensorTransform.
/// \notes Crop the input image at a random location.
/// \note Crop the input image at a random location.
class RandomCrop final : public TensorTransform {
public:
/// \brief Constructor.
@ -364,7 +364,7 @@ class RandomCrop final : public TensorTransform {
};
/// \brief RandomCropDecodeResize TensorTransform.
/// \notes Equivalent to RandomResizedCrop, but crops before decodes.
/// \note Equivalent to RandomResizedCrop, but crops before decodes.
class RandomCropDecodeResize final : public TensorTransform {
public:
/// \brief Constructor.
@ -372,10 +372,10 @@ class RandomCropDecodeResize final : public TensorTransform {
/// If size is a single value, a square crop of size (size, size) is returned.
/// If size has 2 values, it should be (height, width).
/// \param[in] scale Range [min, max) of respective size of the
/// original size to be cropped (default=(0.08, 1.0))
/// original size to be cropped (default=(0.08, 1.0)).
/// \param[in] ratio Range [min, max) of aspect ratio to be
/// cropped (default=(3. / 4., 4. / 3.))
/// \param[in] interpolation An enum for the mode of interpolation
/// cropped (default=(3. / 4., 4. / 3.)).
/// \param[in] interpolation An enum for the mode of interpolation.
/// \param[in] The maximum number of attempts to propose a valid crop_area (default=10).
/// If exceeded, fall back to use center_crop instead.
explicit RandomCropDecodeResize(std::vector<int32_t> size, std::vector<float> scale = {0.08, 1.0},
@ -397,7 +397,7 @@ class RandomCropDecodeResize final : public TensorTransform {
};
/// \brief RandomCropWithBBox TensorTransform.
/// \notes Crop the input image at a random location and adjust bounding boxes accordingly.
/// \note Crop the input image at a random location and adjust bounding boxes accordingly.
/// If cropped area is out of bbox, the return bbox will be empty.
class RandomCropWithBBox final : public TensorTransform {
public:
@ -436,7 +436,7 @@ class RandomCropWithBBox final : public TensorTransform {
};
/// \brief RandomHorizontalFlip TensorTransform.
/// \notes Tensor operation to perform random horizontal flip.
/// \note Tensor operation to perform random horizontal flip.
class RandomHorizontalFlip final : public TensorTransform {
public:
/// \brief Constructor.
@ -457,7 +457,7 @@ class RandomHorizontalFlip final : public TensorTransform {
};
/// \brief RandomHorizontalFlipWithBBox TensorTransform.
/// \notes Flip the input image horizontally, randomly with a given probability and adjust bounding boxes accordingly.
/// \note Flip the input image horizontally, randomly with a given probability and adjust bounding boxes accordingly.
class RandomHorizontalFlipWithBBox final : public TensorTransform {
public:
/// \brief Constructor.
@ -478,11 +478,11 @@ class RandomHorizontalFlipWithBBox final : public TensorTransform {
};
/// \brief RandomPosterize TensorTransform.
/// \notes Tensor operation to perform random posterize.
/// \note Tensor operation to perform random posterize.
class RandomPosterize final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] bit_range - uint8_t vector representing the minimum and maximum bit in range. (Default={4, 8})
/// \param[in] bit_range - uint8_t vector representing the minimum and maximum bit in range (Default={4, 8}).
explicit RandomPosterize(const std::vector<uint8_t> &bit_range = {4, 8});
/// \brief Destructor.
@ -499,13 +499,13 @@ class RandomPosterize final : public TensorTransform {
};
/// \brief RandomResize TensorTransform.
/// \notes Resize the input image using a randomly selected interpolation mode.
/// \note Resize the input image using a randomly selected interpolation mode.
// the same image aspect ratio. If size has 2 values, it should be (height, width).
class RandomResize final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] size A vector representing the output size of the resized image.
/// If size is a single value, the smaller edge of the image will be resized to this value with
/// If size is a single value, the smaller edge of the image will be resized to this value with.
explicit RandomResize(std::vector<int32_t> size);
/// \brief Destructor.
@ -522,7 +522,7 @@ class RandomResize final : public TensorTransform {
};
/// \brief RandomResizeWithBBox TensorTransform.
/// \notes Resize the input image using a randomly selected interpolation mode and adjust
/// \note Resize the input image using a randomly selected interpolation mode and adjust
/// bounding boxes accordingly.
class RandomResizeWithBBox final : public TensorTransform {
public:
@ -546,7 +546,7 @@ class RandomResizeWithBBox final : public TensorTransform {
};
/// \brief RandomResizedCrop TensorTransform.
/// \notes Crop the input image to a random size and aspect ratio.
/// \note Crop the input image to a random size and aspect ratio.
class RandomResizedCrop final : public TensorTransform {
public:
/// \brief Constructor.
@ -554,11 +554,11 @@ class RandomResizedCrop final : public TensorTransform {
/// If size is a single value, a square crop of size (size, size) is returned.
/// If size has 2 values, it should be (height, width).
/// \param[in] scale Range [min, max) of respective size of the original
/// size to be cropped (default=(0.08, 1.0))
/// size to be cropped (default=(0.08, 1.0)).
/// \param[in] ratio Range [min, max) of aspect ratio to be cropped
/// (default=(3. / 4., 4. / 3.)).
/// \param[in] interpolation Image interpolation mode (default=InterpolationMode::kLinear)
/// \param[in] max_attempts The maximum number of attempts to propose a valid
/// \param[in] interpolation Image interpolation mode (default=InterpolationMode::kLinear).
/// \param[in] max_attempts The maximum number of attempts to propose a valid.
/// crop_area (default=10). If exceeded, fall back to use center_crop instead.
explicit RandomResizedCrop(std::vector<int32_t> size, std::vector<float> scale = {0.08, 1.0},
std::vector<float> ratio = {3. / 4., 4. / 3.},
@ -578,7 +578,7 @@ class RandomResizedCrop final : public TensorTransform {
};
/// \brief RandomResizedCropWithBBox TensorTransform.
/// \notes Crop the input image to a random size and aspect ratio.
/// \note Crop the input image to a random size and aspect ratio.
/// If cropped area is out of bbox, the return bbox will be empty.
class RandomResizedCropWithBBox final : public TensorTransform {
public:
@ -587,10 +587,10 @@ class RandomResizedCropWithBBox final : public TensorTransform {
/// If size is a single value, a square crop of size (size, size) is returned.
/// If size has 2 values, it should be (height, width).
/// \param[in] scale Range [min, max) of respective size of the original
/// size to be cropped (default=(0.08, 1.0))
/// size to be cropped (default=(0.08, 1.0)).
/// \param[in] ratio Range [min, max) of aspect ratio to be cropped
/// (default=(3. / 4., 4. / 3.)).
/// \param[in] interpolation Image interpolation mode (default=InterpolationMode::kLinear)
/// \param[in] interpolation Image interpolation mode (default=InterpolationMode::kLinear).
/// \param[in] max_attempts The maximum number of attempts to propose a valid
/// crop_area (default=10). If exceeded, fall back to use center_crop instead.
RandomResizedCropWithBBox(std::vector<int32_t> size, std::vector<float> scale = {0.08, 1.0},
@ -610,16 +610,16 @@ class RandomResizedCropWithBBox final : public TensorTransform {
std::shared_ptr<Data> data_;
};
/// \brief RandomRotation TensorOp
/// \notes Rotates the image according to parameters
/// \brief RandomRotation TensorOp.
/// \note Rotates the image according to parameters.
class RandomRotation final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] degrees A float vector of size, representing the starting and ending degree
/// \param[in] resample An enum for the mode of interpolation
/// \param[in] expand A boolean representing whether the image is expanded after rotation
/// \param[in] degrees A float vector of size, representing the starting and ending degree.
/// \param[in] resample An enum for the mode of interpolation.
/// \param[in] expand A boolean representing whether the image is expanded after rotation.
/// \param[in] center A float vector of size 2, representing the x and y center of rotation.
/// \param[in] fill_value A vector representing the value to fill the area outside the transform
/// \param[in] fill_value A vector representing the value to fill the area outside the transform.
/// in the output image. If 1 value is provided, it is used for all RGB channels.
/// If 3 values are provided, it is used to fill R, G, B channels respectively.
RandomRotation(std::vector<float> degrees, InterpolationMode resample = InterpolationMode::kNearestNeighbour,
@ -640,23 +640,23 @@ class RandomRotation final : public TensorTransform {
};
/// \brief RandomSelectSubpolicy TensorTransform.
/// \notes Choose a random sub-policy from a list to be applied on the input image. A sub-policy is a list of tuples
/// \note Choose a random sub-policy from a list to be applied on the input image. A sub-policy is a list of tuples
/// (op, prob), where op is a TensorTransform operation and prob is the probability that this op will be applied.
/// Once a sub-policy is selected, each op within the sub-policy with be applied in sequence according to its
/// probability.
class RandomSelectSubpolicy final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are raw pointers
/// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are raw pointers.
explicit RandomSelectSubpolicy(const std::vector<std::vector<std::pair<TensorTransform *, double>>> &policy);
/// \brief Constructor.
/// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are shared pointers
/// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are shared pointers.
explicit RandomSelectSubpolicy(
const std::vector<std::vector<std::pair<std::shared_ptr<TensorTransform>, double>>> &policy);
/// \brief Constructor.
/// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are object pointers
/// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are object pointers.
explicit RandomSelectSubpolicy(
const std::vector<std::vector<std::pair<std::reference_wrapper<TensorTransform>, double>>> &policy);
@ -674,11 +674,11 @@ class RandomSelectSubpolicy final : public TensorTransform {
};
/// \brief RandomSharpness TensorTransform.
/// \notes Tensor operation to perform random sharpness.
/// \note Tensor operation to perform random sharpness.
class RandomSharpness final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] degrees A float vector of size 2, representing the starting and ending degree to uniformly
/// \param[in] degrees A float vector of size 2, representing the starting and ending degree to uniformly.
/// sample from, to select a degree to adjust sharpness.
explicit RandomSharpness(std::vector<float> degrees = {0.1, 1.9});
@ -696,8 +696,8 @@ class RandomSharpness final : public TensorTransform {
};
/// \brief RandomSolarize TensorTransform.
/// \notes Invert pixels randomly within specified range. If min=max, it is a single fixed magnitude operation
/// to inverts all pixel above that threshold
/// \note Invert pixels randomly within specified range. If min=max, it is a single fixed magnitude operation
/// to inverts all pixel above that threshold.
class RandomSolarize final : public TensorTransform {
public:
/// \brief Constructor.
@ -718,7 +718,7 @@ class RandomSolarize final : public TensorTransform {
};
/// \brief RandomVerticalFlip TensorTransform.
/// \notes Tensor operation to perform random vertical flip.
/// \note Tensor operation to perform random vertical flip.
class RandomVerticalFlip final : public TensorTransform {
public:
/// \brief Constructor.
@ -739,7 +739,7 @@ class RandomVerticalFlip final : public TensorTransform {
};
/// \brief RandomVerticalFlipWithBBox TensorTransform.
/// \notes Flip the input image vertically, randomly with a given probability and adjust bounding boxes accordingly.
/// \note Flip the input image vertically, randomly with a given probability and adjust bounding boxes accordingly.
class RandomVerticalFlipWithBBox final : public TensorTransform {
public:
/// \brief Constructor.
@ -760,7 +760,7 @@ class RandomVerticalFlipWithBBox final : public TensorTransform {
};
/// \brief RescaleOperation TensorTransform.
/// \notes Tensor operation to rescale the input image.
/// \note Tensor operation to rescale the input image.
class Rescale final : public TensorTransform {
public:
/// \brief Constructor.
@ -782,7 +782,7 @@ class Rescale final : public TensorTransform {
};
/// \brief ResizeWithBBox TensorTransform.
/// \notes Resize the input image to the given size and adjust bounding boxes accordingly.
/// \note Resize the input image to the given size and adjust bounding boxes accordingly.
class ResizeWithBBox final : public TensorTransform {
public:
/// \brief Constructor.
@ -806,7 +806,7 @@ class ResizeWithBBox final : public TensorTransform {
};
/// \brief RgbaToBgr TensorTransform.
/// \notes Changes the input 4 channel RGBA tensor to 3 channel BGR.
/// \note Changes the input 4 channel RGBA tensor to 3 channel BGR.
class RGBA2BGR final : public TensorTransform {
public:
/// \brief Constructor.
@ -822,7 +822,7 @@ class RGBA2BGR final : public TensorTransform {
};
/// \brief RgbaToRgb TensorTransform.
/// \notes Changes the input 4 channel RGBA tensor to 3 channel RGB.
/// \note Changes the input 4 channel RGBA tensor to 3 channel RGB.
class RGBA2RGB final : public TensorTransform {
public:
/// \brief Constructor.
@ -838,7 +838,7 @@ class RGBA2RGB final : public TensorTransform {
};
/// \brief SoftDvppDecodeRandomCropResizeJpeg TensorTransform.
/// \notes Tensor operation to decode, random crop and resize JPEG image using the simulation algorithm of
/// \note Tensor operation to decode, random crop and resize JPEG image using the simulation algorithm of
/// Ascend series chip DVPP module. The usage scenario is consistent with SoftDvppDecodeResizeJpeg.
/// The input image size should be in range [32*32, 8192*8192].
/// The zoom-out and zoom-in multiples of the image length and width should in the range [1/32, 16].
@ -872,7 +872,7 @@ class SoftDvppDecodeRandomCropResizeJpeg final : public TensorTransform {
};
/// \brief SoftDvppDecodeResizeJpeg TensorTransform.
/// \notes Tensor operation to decode and resize JPEG image using the simulation algorithm of Ascend series
/// \note Tensor operation to decode and resize JPEG image using the simulation algorithm of Ascend series
/// chip DVPP module. It is recommended to use this algorithm in the following scenarios:
/// When training, the DVPP of the Ascend chip is not used,
/// and the DVPP of the Ascend chip is used during inference,
@ -901,8 +901,8 @@ class SoftDvppDecodeResizeJpeg final : public TensorTransform {
std::shared_ptr<Data> data_;
};
/// \brief SwapRedBlue TensorOp
/// \notes Swaps the red and blue channels in image
/// \brief SwapRedBlue TensorOp.
/// \note Swaps the red and blue channels in image.
class SwapRedBlue final : public TensorTransform {
public:
/// \brief Constructor.
@ -918,7 +918,7 @@ class SwapRedBlue final : public TensorTransform {
};
/// \brief UniformAugment TensorTransform.
/// \notes Tensor operation to perform randomly selected augmentation.
/// \note Tensor operation to perform randomly selected augmentation.
class UniformAugment final : public TensorTransform {
public:
/// \brief Constructor.

View File

@ -36,16 +36,16 @@ namespace vision {
class RotateOperation;
/// \brief Affine TensorTransform.
/// \notes Apply affine transform on input image.
/// \note Apply affine transform on input image.
class Affine final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] degrees The degrees to rotate the image by
/// \param[in] translation The value representing vertical and horizontal translation (default = {0.0, 0.0})
/// \param[in] degrees The degrees to rotate the image by.
/// \param[in] translation The value representing vertical and horizontal translation (default = {0.0, 0.0}).
/// The first value represent the x axis translation while the second represents y axis translation.
/// \param[in] scale The scaling factor for the image (default = 0.0)
/// \param[in] shear A float vector of size 2, representing the shear degrees (default = {0.0, 0.0})
/// \param[in] interpolation An enum for the mode of interpolation
/// \param[in] scale The scaling factor for the image (default = 0.0).
/// \param[in] shear A float vector of size 2, representing the shear degrees (default = {0.0, 0.0}).
/// \param[in] interpolation An enum for the mode of interpolation.
/// \param[in] fill_value A vector representing the value to fill the area outside the transform
/// in the output image. If 1 value is provided, it is used for all RGB channels.
/// If 3 values are provided, it is used to fill R, G, B channels respectively.
@ -67,7 +67,7 @@ class Affine final : public TensorTransform {
};
/// \brief CenterCrop TensorTransform.
/// \notes Crops the input image at the center to the given size.
/// \note Crops the input image at the center to the given size.
class CenterCrop final : public TensorTransform {
public:
/// \brief Constructor.
@ -92,7 +92,7 @@ class CenterCrop final : public TensorTransform {
};
/// \brief RGB2GRAY TensorTransform.
/// \notes Convert RGB image or color image to grayscale image
/// \note Convert RGB image or color image to grayscale image.
class RGB2GRAY final : public TensorTransform {
public:
/// \brief Constructor.
@ -108,11 +108,11 @@ class RGB2GRAY final : public TensorTransform {
};
/// \brief Crop TensorTransform.
/// \notes Crop an image based on location and crop size
/// \note Crop an image based on location and crop size.
class Crop final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] coordinates Starting location of crop. Must be a vector of two values, in the form of {x_coor, y_coor}
/// \param[in] coordinates Starting location of crop. Must be a vector of two values, in the form of {x_coor, y_coor}.
/// \param[in] size Size of the cropped area.
/// If size is a single value, a square crop of size (size, size) is returned.
/// If size has 2 values, it should be (height, width).
@ -132,7 +132,7 @@ class Crop final : public TensorTransform {
};
/// \brief Decode TensorTransform.
/// \notes Decode the input image in RGB mode.
/// \note Decode the input image in RGB mode.
class Decode final : public TensorTransform {
public:
/// \brief Constructor.
@ -155,14 +155,14 @@ class Decode final : public TensorTransform {
};
/// \brief Normalize TensorTransform.
/// \notes Normalize the input image with respect to mean and standard deviation.
/// \note Normalize the input image with respect to mean and standard deviation.
class Normalize final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] mean A vector of mean values for each channel, w.r.t channel order.
/// The mean values must be in range [0.0, 255.0].
/// \param[in] std A vector of standard deviations for each channel, w.r.t. channel order.
/// The standard deviation values must be in range (0.0, 255.0]
/// The standard deviation values must be in range (0.0, 255.0].
Normalize(std::vector<float> mean, std::vector<float> std);
/// \brief Destructor.
@ -181,21 +181,21 @@ class Normalize final : public TensorTransform {
};
/// \brief RandomAffine TensorTransform.
/// \notes Applies a Random Affine transformation on input image in RGB or Greyscale mode.
/// \note Applies a Random Affine transformation on input image in RGB or Greyscale mode.
class RandomAffine final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] degrees A float vector of size 2, representing the starting and ending degree
/// \param[in] degrees A float vector of size 2, representing the starting and ending degree.
/// \param[in] translate_range A float vector of size 2 or 4, representing percentages of translation on x and y axes.
/// if size is 2, (min_dx, max_dx, 0, 0)
/// if size is 4, (min_dx, max_dx, min_dy, max_dy)
/// all values are in range [-1, 1]
/// If size is 2, (min_dx, max_dx, 0, 0).
/// if size is 4, (min_dx, max_dx, min_dy, max_dy),
/// all values are in range [-1, 1].
/// \param[in] scale_range A float vector of size 2, representing the starting and ending scales in the range.
/// \param[in] shear_ranges A float vector of size 2 or 4, representing the starting and ending shear degrees
/// vertically and horizontally.
/// if size is 2, (min_shear_x, max_shear_x, 0, 0)
/// if size is 4, (min_shear_x, max_shear_x, min_shear_y, max_shear_y)
/// \param[in] interpolation An enum for the mode of interpolation
/// If size is 2, (min_shear_x, max_shear_x, 0, 0),
/// if size is 4, (min_shear_x, max_shear_x, min_shear_y, max_shear_y).
/// \param[in] interpolation An enum for the mode of interpolation.
/// \param[in] fill_value A vector representing the value to fill the area outside the transform
/// in the output image. If 1 value is provided, it is used for all RGB channels.
/// If 3 values are provided, it is used to fill R, G, B channels respectively.
@ -219,14 +219,14 @@ class RandomAffine final : public TensorTransform {
};
/// \brief Resize TensorTransform.
/// \notes Resize the input image to the given size.
/// \note Resize the input image to the given size.
class Resize final : public TensorTransform {
public:
/// \brief Constructor.
/// \param[in] size A vector representing the output size of the resized image.
/// If size is a single value, the image will be resized to this value with
/// the same image aspect ratio. If size has 2 values, it should be (height, width).
/// \param[in] interpolation An enum for the mode of interpolation
/// \param[in] interpolation An enum for the mode of interpolation.
explicit Resize(std::vector<int32_t> size, InterpolationMode interpolation = InterpolationMode::kLinear);
/// \brief Destructor.
@ -245,7 +245,7 @@ class Resize final : public TensorTransform {
};
/// \brief ResizePreserveAR TensorTransform.
/// \notes Keep the original picture ratio and fill the rest.
/// \note Keep the original picture ratio and fill the rest.
class ResizePreserveAR final : public TensorTransform {
public:
/// \brief Constructor.
@ -268,7 +268,7 @@ class ResizePreserveAR final : public TensorTransform {
};
/// \brief Rotate TensorTransform.
/// \notes Rotate the input image using a specified angle id.
/// \note Rotate the input image using a specified angle id.
class Rotate final : public TensorTransform {
public:
/// \brief Constructor.