commit
7643089c00
|
@ -38,7 +38,7 @@ class TensorOperation;
|
|||
namespace audio {
|
||||
|
||||
/// \brief Compute the angle of complex tensor input.
|
||||
class Angle final : public TensorTransform {
|
||||
class MS_API Angle final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
Angle();
|
||||
|
@ -52,7 +52,7 @@ class Angle final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design two-pole band filter.
|
||||
class BandBiquad final : public TensorTransform {
|
||||
class MS_API BandBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -75,7 +75,7 @@ class BandBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design two-pole allpass filter. Similar to SoX implementation.
|
||||
class AllpassBiquad final : public TensorTransform {
|
||||
class MS_API AllpassBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
/// \param[in] central_freq Central frequency (in Hz).
|
||||
|
@ -97,7 +97,7 @@ class AllpassBiquad final : public TensorTransform {
|
|||
|
||||
/// \brief AmplitudeToDB TensorTransform.
|
||||
/// \notes Turn a tensor from the power/amplitude scale to the decibel scale.
|
||||
class AmplitudeToDB final : public TensorTransform {
|
||||
class MS_API AmplitudeToDB final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] stype Scale of input tensor, must be one of [ScaleType::kPower, ScaleType::kMagnitude] (Default:
|
||||
|
@ -122,7 +122,7 @@ class AmplitudeToDB final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design two-pole band-pass filter.
|
||||
class BandpassBiquad final : public TensorTransform {
|
||||
class MS_API BandpassBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -146,7 +146,7 @@ class BandpassBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design two-pole band-reject filter. Similar to SoX implementation.
|
||||
class BandrejectBiquad final : public TensorTransform {
|
||||
class MS_API BandrejectBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -168,7 +168,7 @@ class BandrejectBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design a bass tone-control effect.
|
||||
class BassBiquad final : public TensorTransform {
|
||||
class MS_API BassBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -191,7 +191,7 @@ class BassBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Perform a biquad filter of input tensor.
|
||||
class Biquad final : public TensorTransform {
|
||||
class MS_API Biquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] b0 Numerator coefficient of current input, x[n].
|
||||
|
@ -217,7 +217,7 @@ class Biquad final : public TensorTransform {
|
|||
|
||||
/// \brief ComplexNorm TensorTransform.
|
||||
/// \notes Compute the norm of complex tensor input.
|
||||
class ComplexNorm final : public TensorTransform {
|
||||
class MS_API ComplexNorm final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] power Power of the norm, which must be non-negative (Default: 1.0).
|
||||
|
@ -238,7 +238,7 @@ class ComplexNorm final : public TensorTransform {
|
|||
|
||||
/// \brief ComputeDeltas Transform.
|
||||
/// \note Compute delta coefficients of a spectrogram.
|
||||
class ComputeDeltas final : public TensorTransform {
|
||||
class MS_API ComputeDeltas final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Construct a new Compute Deltas object.
|
||||
/// \param[in] win_length The window length used for computing delta, must be no less than 3 (Default: 5).
|
||||
|
@ -259,7 +259,7 @@ class ComputeDeltas final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply contrast effect.
|
||||
class Contrast final : public TensorTransform {
|
||||
class MS_API Contrast final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] enhancement_amount Controls the amount of the enhancement (Default: 75.0).
|
||||
|
@ -279,7 +279,7 @@ class Contrast final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Turn a waveform from the decibel scale to the power/amplitude scale.
|
||||
class DBToAmplitude final : public TensorTransform {
|
||||
class MS_API DBToAmplitude final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor
|
||||
/// \param[in] ref Reference which the output will be scaled by.
|
||||
|
@ -300,7 +300,7 @@ class DBToAmplitude final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply a DC shift to the audio.
|
||||
class DCShift : public TensorTransform {
|
||||
class MS_API DCShift : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor
|
||||
/// \param[in] shift Indicates the amount to shift the audio, the value must be in the range [-2.0, 2.0].
|
||||
|
@ -332,7 +332,7 @@ class DCShift : public TensorTransform {
|
|||
Status CreateDct(mindspore::MSTensor *output, int32_t n_mfcc, int32_t n_mels, NormMode norm = NormMode::kNone);
|
||||
|
||||
/// \brief Design two-pole deemph filter. Similar to SoX implementation.
|
||||
class DeemphBiquad final : public TensorTransform {
|
||||
class MS_API DeemphBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, the value can only be 44100 (Hz) or 48000(hz).
|
||||
explicit DeemphBiquad(int32_t sample_rate);
|
||||
|
@ -351,7 +351,7 @@ class DeemphBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Detect pitch frequency.
|
||||
class DetectPitchFrequency final : public TensorTransform {
|
||||
class MS_API DetectPitchFrequency final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -378,7 +378,7 @@ class DetectPitchFrequency final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief EqualizerBiquad TensorTransform. Apply highpass biquad filter on audio.
|
||||
class EqualizerBiquad final : public TensorTransform {
|
||||
class MS_API EqualizerBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -401,7 +401,7 @@ class EqualizerBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Add fade in or/and fade out on the input audio.
|
||||
class Fade final : public TensorTransform {
|
||||
class MS_API Fade final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] fade_in_len Length of fade-in (time frames), which must be non-negative
|
||||
|
@ -425,7 +425,7 @@ class Fade final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply a flanger effect to the audio.
|
||||
class Flanger final : public TensorTransform {
|
||||
class MS_API Flanger final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz).
|
||||
|
@ -458,7 +458,7 @@ class Flanger final : public TensorTransform {
|
|||
|
||||
/// \brief FrequencyMasking TensorTransform.
|
||||
/// \notes Apply masking to a spectrogram in the frequency domain.
|
||||
class FrequencyMasking final : public TensorTransform {
|
||||
class MS_API FrequencyMasking final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] iid_masks Whether to apply different masks to each example.
|
||||
|
@ -484,7 +484,7 @@ class FrequencyMasking final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief HighpassBiquad TensorTransform. Apply highpass biquad filter on audio.
|
||||
class HighpassBiquad final : public TensorTransform {
|
||||
class MS_API HighpassBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -506,7 +506,7 @@ class HighpassBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design filter. Similar to SoX implementation.
|
||||
class LFilter final : public TensorTransform {
|
||||
class MS_API LFilter final : public TensorTransform {
|
||||
public:
|
||||
/// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1).
|
||||
/// Lower delays coefficients are first, e.g. [a0, a1, a2, ...].
|
||||
|
@ -531,7 +531,7 @@ class LFilter final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design biquad lowpass filter and perform filtering. Similar to SoX implementation.
|
||||
class LowpassBiquad final : public TensorTransform {
|
||||
class MS_API LowpassBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -553,7 +553,7 @@ class LowpassBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Separate a complex-valued spectrogram with shape (..., 2) into its magnitude and phase.
|
||||
class Magphase final : public TensorTransform {
|
||||
class MS_API Magphase final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] power Power of the norm, which must be non-negative (Default: 1.0).
|
||||
|
@ -574,7 +574,7 @@ class Magphase final : public TensorTransform {
|
|||
|
||||
/// \brief MuLawDecoding TensorTransform.
|
||||
/// \note Decode mu-law encoded signal.
|
||||
class MuLawDecoding final : public TensorTransform {
|
||||
class MS_API MuLawDecoding final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] quantization_channels Number of channels, which must be positive (Default: 256).
|
||||
|
@ -595,7 +595,7 @@ class MuLawDecoding final : public TensorTransform {
|
|||
|
||||
/// \brief MuLawEncoding TensorTransform.
|
||||
/// \note Encode signal based on mu-law companding.
|
||||
class MuLawEncoding final : public TensorTransform {
|
||||
class MS_API MuLawEncoding final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] quantization_channels Number of channels, which must be positive (Default: 256).
|
||||
|
@ -615,7 +615,7 @@ class MuLawEncoding final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Overdrive TensorTransform.
|
||||
class Overdrive final : public TensorTransform {
|
||||
class MS_API Overdrive final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] gain Coefficient of overload in dB, in range of [0, 100] (Default: 20.0).
|
||||
|
@ -636,7 +636,7 @@ class Overdrive final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Phaser TensorTransform.
|
||||
class Phaser final : public TensorTransform {
|
||||
class MS_API Phaser final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz).
|
||||
|
@ -666,7 +666,7 @@ class Phaser final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply RIAA vinyl playback equalization.
|
||||
class RiaaBiquad final : public TensorTransform {
|
||||
class MS_API RiaaBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz),
|
||||
|
@ -687,7 +687,7 @@ class RiaaBiquad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply sliding-window cepstral mean (and optionally variance) normalization per utterance.
|
||||
class SlidingWindowCmn final : public TensorTransform {
|
||||
class MS_API SlidingWindowCmn final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor of SlidingWindowCmnOp.
|
||||
/// \param[in] cmn_window The window in frames for running average CMN computation (Default: 600).
|
||||
|
@ -714,7 +714,7 @@ class SlidingWindowCmn final : public TensorTransform {
|
|||
|
||||
/// \brief TimeMasking TensorTransform.
|
||||
/// \notes Apply masking to a spectrogram in the time domain.
|
||||
class TimeMasking final : public TensorTransform {
|
||||
class MS_API TimeMasking final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] iid_masks Whether to apply different masks to each example.
|
||||
|
@ -741,7 +741,7 @@ class TimeMasking final : public TensorTransform {
|
|||
|
||||
/// \brief TimeStretch TensorTransform
|
||||
/// \notes Stretch STFT in time at a given rate, without changing the pitch.
|
||||
class TimeStretch final : public TensorTransform {
|
||||
class MS_API TimeStretch final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] hop_length Length of hop between STFT windows (Default: None, will use ((n_freq - 1) * 2) // 2).
|
||||
|
@ -765,7 +765,7 @@ class TimeStretch final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Design a treble tone-control effect.
|
||||
class TrebleBiquad final : public TensorTransform {
|
||||
class MS_API TrebleBiquad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.
|
||||
|
@ -789,7 +789,7 @@ class TrebleBiquad final : public TensorTransform {
|
|||
|
||||
/// \brief Vol TensorTransform.
|
||||
/// \notes Add a volume to an waveform.
|
||||
class Vol final : public TensorTransform {
|
||||
class MS_API Vol final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] gain Gain value, varies according to the value of gain_type. If gain_type is GainType::kAmplitude,
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace config {
|
|||
/// // Operations with randomness will use the seed value to generate random values.
|
||||
/// bool rc = config::set_seed(5);
|
||||
/// \endcode
|
||||
bool set_seed(int32_t seed);
|
||||
bool MS_API set_seed(int32_t seed);
|
||||
|
||||
/// \brief A function to get the seed.
|
||||
/// \return The seed set in the configuration.
|
||||
|
@ -47,7 +47,7 @@ bool set_seed(int32_t seed);
|
|||
/// // If set_seed() is never called before, the default value(std::mt19937::default_seed) will be returned.
|
||||
/// uint32_t seed = config::get_seed();
|
||||
/// \endcode
|
||||
uint32_t get_seed();
|
||||
uint32_t MS_API get_seed();
|
||||
|
||||
/// \brief A function to set the number of rows to be prefetched.
|
||||
/// \param[in] prefetch_size Total number of rows to be prefetched.
|
||||
|
@ -57,7 +57,7 @@ uint32_t get_seed();
|
|||
/// // Set a new global configuration value for the prefetch size.
|
||||
/// bool rc = config::set_prefetch_size(1000);
|
||||
/// \endcode
|
||||
bool set_prefetch_size(int32_t prefetch_size);
|
||||
bool MS_API set_prefetch_size(int32_t prefetch_size);
|
||||
|
||||
/// \brief A function to get the prefetch size in number of rows.
|
||||
/// \return Total number of rows to be prefetched.
|
||||
|
@ -67,7 +67,7 @@ bool set_prefetch_size(int32_t prefetch_size);
|
|||
/// // If set_prefetch_size() is never called before, the default value(16) will be returned.
|
||||
/// int32_t prefetch_size = config::get_prefetch_size();
|
||||
/// \endcode
|
||||
int32_t get_prefetch_size();
|
||||
int32_t MS_API get_prefetch_size();
|
||||
|
||||
/// \brief A function to set the default number of parallel workers.
|
||||
/// \param[in] num_parallel_workers Number of parallel workers to be used as the default for each operation.
|
||||
|
@ -78,7 +78,7 @@ int32_t get_prefetch_size();
|
|||
/// // Now parallel dataset operators will run with 16 workers.
|
||||
/// bool rc = config::set_num_parallel_workers(16);
|
||||
/// \endcode
|
||||
bool set_num_parallel_workers(int32_t num_parallel_workers);
|
||||
bool MS_API set_num_parallel_workers(int32_t num_parallel_workers);
|
||||
|
||||
/// \brief A function to get the default number of parallel workers.
|
||||
/// \return Number of parallel workers to be used as the default for each operation.
|
||||
|
@ -88,7 +88,7 @@ bool set_num_parallel_workers(int32_t num_parallel_workers);
|
|||
/// // If set_num_parallel_workers() is never called before, the default value(8) will be returned.
|
||||
/// int32_t parallel_workers = config::get_num_parallel_workers();
|
||||
/// \endcode
|
||||
int32_t get_num_parallel_workers();
|
||||
int32_t MS_API get_num_parallel_workers();
|
||||
|
||||
/// \brief A function to set the default interval (in milliseconds) for monitor sampling.
|
||||
/// \param[in] interval Interval (in milliseconds) to be used for performance monitor sampling.
|
||||
|
@ -98,7 +98,7 @@ int32_t get_num_parallel_workers();
|
|||
/// // Set a new global configuration value for the monitor sampling interval.
|
||||
/// bool rc = config::set_monitor_sampling_interval(100);
|
||||
/// \endcode
|
||||
bool set_monitor_sampling_interval(int32_t interval);
|
||||
bool MS_API set_monitor_sampling_interval(int32_t interval);
|
||||
|
||||
/// \brief A function to get the default interval of performance monitor sampling.
|
||||
/// \return Interval (in milliseconds) for performance monitor sampling.
|
||||
|
@ -108,7 +108,7 @@ bool set_monitor_sampling_interval(int32_t interval);
|
|||
/// // If set_monitor_sampling_interval() is never called before, the default value(1000) will be returned.
|
||||
/// int32_t sampling_interval = config::get_monitor_sampling_interval();
|
||||
/// \endcode
|
||||
int32_t get_monitor_sampling_interval();
|
||||
int32_t MS_API get_monitor_sampling_interval();
|
||||
|
||||
/// \brief A function to set the default timeout (in seconds) for DSWaitedCallback. In case of a deadlock, the wait
|
||||
/// function will exit after the timeout period.
|
||||
|
@ -119,7 +119,7 @@ int32_t get_monitor_sampling_interval();
|
|||
/// // Set a new global configuration value for the timeout value.
|
||||
/// bool rc = config::set_callback_timeout(100);
|
||||
/// \endcode
|
||||
bool set_callback_timeout(int32_t timeout);
|
||||
bool MS_API set_callback_timeout(int32_t timeout);
|
||||
|
||||
/// \brief A function to get the default timeout for DSWaitedCallback. In case of a deadback, the wait function
|
||||
/// will exit after the timeout period.
|
||||
|
@ -130,14 +130,14 @@ bool set_callback_timeout(int32_t timeout);
|
|||
/// // If set_callback_timeout() is never called before, the default value(60) will be returned.
|
||||
/// int32_t callback_timeout = config::get_callback_timeout();
|
||||
/// \endcode
|
||||
int32_t get_callback_timeout();
|
||||
int32_t MS_API get_callback_timeout();
|
||||
|
||||
/// \brief A function to load the configuration from a file.
|
||||
/// \param[in] file Path of the configuration file to be loaded.
|
||||
/// \return The config file is loaded successfully or not.
|
||||
/// \note The reason for using this API is that std::string will be constrained by the
|
||||
/// compiler option '_GLIBCXX_USE_CXX11_ABI' while char is free of this restriction.
|
||||
bool load(const std::vector<char> &file);
|
||||
bool MS_API load(const std::vector<char> &file);
|
||||
|
||||
/// \brief A function to load the configuration from a file.
|
||||
/// \param[in] file Path of the configuration file to be loaded.
|
||||
|
@ -155,7 +155,7 @@ bool load(const std::vector<char> &file);
|
|||
/// std::string config_file = "/path/to/config/file";
|
||||
/// bool rc = config::load(config_file);
|
||||
/// \endcode
|
||||
inline bool load(std::string file) { return load(StringToChar(file)); }
|
||||
inline bool MS_API load(std::string file) { return load(StringToChar(file)); }
|
||||
|
||||
} // namespace config
|
||||
} // namespace dataset
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <limits>
|
||||
#include <random>
|
||||
|
||||
#include "include/api/types.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace dataset {
|
||||
// Various type defines for convenience
|
||||
|
@ -27,26 +29,26 @@ using uchar = unsigned char;
|
|||
using dsize_t = int64_t;
|
||||
|
||||
/// \brief The modulation in Flanger
|
||||
enum class Modulation {
|
||||
enum class MS_API Modulation {
|
||||
kSinusoidal = 0, ///< Use sinusoidal modulation.
|
||||
kTriangular = 1 ///< Use triangular modulation.
|
||||
};
|
||||
|
||||
/// \brief The interpolation in Flanger
|
||||
enum class Interpolation {
|
||||
enum class MS_API Interpolation {
|
||||
kLinear = 0, ///< Use linear for delay-line interpolation.
|
||||
kQuadratic = 1 ///< Use quadratic for delay-line interpolation.
|
||||
};
|
||||
|
||||
/// \brief The dataset auto augment policy in AutoAugment
|
||||
enum class AutoAugmentPolicy {
|
||||
enum class MS_API AutoAugmentPolicy {
|
||||
kImageNet = 0, ///< AutoAugment policy learned on the ImageNet dataset.
|
||||
kCifar10 = 1, ///< AutoAugment policy learned on the Cifar10 dataset.
|
||||
kSVHN = 2 ///< AutoAugment policy learned on the SVHN dataset.
|
||||
};
|
||||
|
||||
/// \brief The color conversion code
|
||||
enum class ConvertMode {
|
||||
enum class MS_API ConvertMode {
|
||||
COLOR_BGR2BGRA = 0, ///< Add alpha channel to BGR image.
|
||||
COLOR_RGB2RGBA = COLOR_BGR2BGRA, ///< Add alpha channel to RGB image.
|
||||
COLOR_BGRA2BGR = 1, ///< Remove alpha channel to BGR image.
|
||||
|
@ -70,20 +72,20 @@ enum class ConvertMode {
|
|||
};
|
||||
|
||||
/// \brief Values of norm in CreateDct.
|
||||
enum class NormMode {
|
||||
enum class MS_API NormMode {
|
||||
kNone = 0, ///< None type norm.
|
||||
kOrtho = 1 ///< Ortho type norm.
|
||||
};
|
||||
|
||||
/// \brief Target devices to perform map operation.
|
||||
enum class MapTargetDevice {
|
||||
enum class MS_API MapTargetDevice {
|
||||
kCpu, ///< CPU Device.
|
||||
kGpu, ///< Gpu Device.
|
||||
kAscend310 ///< Ascend310 Device.
|
||||
};
|
||||
|
||||
/// \brief The initial type of tensor implementation.
|
||||
enum class TensorImpl {
|
||||
enum class MS_API TensorImpl {
|
||||
kNone, ///< None type tensor.
|
||||
kFlexible, ///< Flexible type tensor, can be converted to any type.
|
||||
kCv, ///< CV type tensor.
|
||||
|
@ -91,7 +93,7 @@ enum class TensorImpl {
|
|||
};
|
||||
|
||||
/// \brief The mode for shuffling data.
|
||||
enum class ShuffleMode {
|
||||
enum class MS_API ShuffleMode {
|
||||
kFalse = 0, ///< No shuffling is performed.
|
||||
kFiles = 1, ///< Shuffle files only.
|
||||
kGlobal = 2, ///< Shuffle both the files and samples.
|
||||
|
@ -99,20 +101,20 @@ enum class ShuffleMode {
|
|||
};
|
||||
|
||||
/// \brief Possible scale for input audio.
|
||||
enum class ScaleType {
|
||||
enum class MS_API ScaleType {
|
||||
kMagnitude = 0, ///< Audio scale is magnitude.
|
||||
kPower = 1, ///< Audio scale is power.
|
||||
};
|
||||
|
||||
/// \brief The scale for gain type.
|
||||
enum class GainType {
|
||||
enum class MS_API GainType {
|
||||
kAmplitude = 0, ///< Audio gain type is amplitude.
|
||||
kPower = 1, ///< Audio gain type is power.
|
||||
kDb = 2, ///< Audio gain type is db.
|
||||
};
|
||||
|
||||
/// \brief The method of padding.
|
||||
enum class BorderType {
|
||||
enum class MS_API BorderType {
|
||||
kConstant = 0, ///< Fill the border with constant values.
|
||||
kEdge = 1, ///< Fill the border with the last value on the edge.
|
||||
kReflect = 2, ///< Reflect the values on the edge omitting the last value of edge.
|
||||
|
@ -120,7 +122,7 @@ enum class BorderType {
|
|||
};
|
||||
|
||||
/// \brief Possible fix rotation angle for Rotate Op.
|
||||
enum class FixRotationAngle {
|
||||
enum class MS_API FixRotationAngle {
|
||||
k0Degree = 1, ///< Rotate 0 degree.
|
||||
k0DegreeAndMirror = 2, ///< Rotate 0 degree and apply horizontal flip.
|
||||
k180Degree = 3, ///< Rotate 180 degree.
|
||||
|
@ -132,20 +134,20 @@ enum class FixRotationAngle {
|
|||
};
|
||||
|
||||
/// \brief Possible options for Image format types in a batch.
|
||||
enum class ImageBatchFormat {
|
||||
enum class MS_API ImageBatchFormat {
|
||||
kNHWC = 0, ///< Indicate the input batch is of NHWC format.
|
||||
kNCHW = 1 ///< Indicate the input batch is of NCHW format.
|
||||
};
|
||||
|
||||
/// \brief Possible options for Image format types.
|
||||
enum class ImageFormat {
|
||||
enum class MS_API ImageFormat {
|
||||
HWC = 0, ///< Indicate the input batch is of NHWC format
|
||||
CHW = 1, ///< Indicate the input batch is of NHWC format
|
||||
HW = 2 ///< Indicate the input batch is of NHWC format
|
||||
};
|
||||
|
||||
/// \brief Possible options for interpolation method.
|
||||
enum class InterpolationMode {
|
||||
enum class MS_API InterpolationMode {
|
||||
kLinear = 0, ///< Interpolation method is linear interpolation.
|
||||
kNearestNeighbour = 1, ///< Interpolation method is nearest-neighbor interpolation.
|
||||
kCubic = 2, ///< Interpolation method is bicubic interpolation.
|
||||
|
@ -154,26 +156,26 @@ enum class InterpolationMode {
|
|||
};
|
||||
|
||||
/// \brief Possible tokenize modes for JiebaTokenizer.
|
||||
enum class JiebaMode {
|
||||
enum class MS_API JiebaMode {
|
||||
kMix = 0, ///< Tokenize with MPSegment algorithm.
|
||||
kMp = 1, ///< Tokenize with Hiddel Markov Model Segment algorithm.
|
||||
kHmm = 2 ///< Tokenize with a mix of MPSegment and HMMSegment algorithm.
|
||||
};
|
||||
|
||||
/// \brief Possible options for SPieceTokenizerOutType.
|
||||
enum class SPieceTokenizerOutType {
|
||||
enum class MS_API SPieceTokenizerOutType {
|
||||
kString = 0, ///< Output of sentencepiece tokenizer is string type.
|
||||
kInt = 1 ///< Output of sentencepiece tokenizer is int type.
|
||||
};
|
||||
|
||||
/// \brief Possible options for SPieceTokenizerLoadType.
|
||||
enum class SPieceTokenizerLoadType {
|
||||
enum class MS_API SPieceTokenizerLoadType {
|
||||
kFile = 0, ///< Load sentencepiece tokenizer from local sentencepiece vocab file.
|
||||
kModel = 1 ///< Load sentencepiece tokenizer from sentencepiece vocab instance.
|
||||
};
|
||||
|
||||
/// \brief Type options for SentencePiece Model.
|
||||
enum class SentencePieceModel {
|
||||
enum class MS_API SentencePieceModel {
|
||||
kUnigram = 0, ///< Based on Unigram model.
|
||||
kBpe = 1, ///< Based on Byte Pair Encoding (BPE) model.
|
||||
kChar = 2, ///< Based on Char model.
|
||||
|
@ -181,7 +183,7 @@ enum class SentencePieceModel {
|
|||
};
|
||||
|
||||
/// \brief Possible options to specify a specific normalize mode.
|
||||
enum class NormalizeForm {
|
||||
enum class MS_API NormalizeForm {
|
||||
kNone = 0, ///< Keep the input string tensor unchanged.
|
||||
kNfc, ///< Normalize with Normalization Form C.
|
||||
kNfkc, ///< Normalize with Normalization Form KC.
|
||||
|
@ -190,7 +192,7 @@ enum class NormalizeForm {
|
|||
};
|
||||
|
||||
/// \brief Possible options for Mask.
|
||||
enum class RelationalOp {
|
||||
enum class MS_API RelationalOp {
|
||||
kEqual = 0, ///< equal to `==`
|
||||
kNotEqual, ///< equal to `!=`
|
||||
kLess, ///< equal to `<`
|
||||
|
@ -200,26 +202,26 @@ enum class RelationalOp {
|
|||
};
|
||||
|
||||
/// \brief Possible modes for slice patches.
|
||||
enum class SliceMode {
|
||||
enum class MS_API SliceMode {
|
||||
kPad = 0, ///< Pad some pixels before slice to patches.
|
||||
kDrop = 1, ///< Drop remainder pixels before slice to patches.
|
||||
};
|
||||
|
||||
/// \brief Possible options for SamplingStrategy.
|
||||
enum class SamplingStrategy {
|
||||
enum class MS_API SamplingStrategy {
|
||||
kRandom = 0, ///< Random sampling with replacement.
|
||||
kEdgeWeight = 1 ///< Sampling with edge weight as probability.
|
||||
};
|
||||
|
||||
/// \brief Possible values for output format in get all neighbors function of gnn dataset
|
||||
enum class OutputFormat {
|
||||
enum class MS_API OutputFormat {
|
||||
kNormal = 0, ///< Normal format.
|
||||
kCoo = 1, ///< COO format.
|
||||
kCsr = 2 ///< CSR format.
|
||||
};
|
||||
|
||||
/// \brief Possible options for fade shape.
|
||||
enum class FadeShape {
|
||||
enum class MS_API FadeShape {
|
||||
kLinear = 0, ///< Fade shape is linear mode.
|
||||
kExponential = 1, ///< Fade shape is exponential mode.
|
||||
kLogarithmic = 2, ///< Fade shape is logarithmic mode.
|
||||
|
@ -231,12 +233,12 @@ enum class FadeShape {
|
|||
/// \param[in] bits a 32bit int to be tested
|
||||
/// \param[in] bitMask a 32bit int representing bit mask
|
||||
/// \return bool Result for the check
|
||||
inline bool BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; }
|
||||
inline bool MS_API BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; }
|
||||
|
||||
/// \brief Convenience function to set bitmask for a 32bit int
|
||||
/// \param[in] bits a 32bit int to deal with
|
||||
/// \param[in] bitMask a 32bit int representing bit mask
|
||||
inline void BitSet(uint32_t *bits, uint32_t bitMask) {
|
||||
inline void MS_API BitSet(uint32_t *bits, uint32_t bitMask) {
|
||||
if (bits == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
@ -246,7 +248,7 @@ inline void BitSet(uint32_t *bits, uint32_t bitMask) {
|
|||
/// \brief Convenience function to clear bitmask from a 32bit int
|
||||
/// \param[in] bits a 32bit int to deal with
|
||||
/// \param[in] bitMask a 32bit int representing bit mask
|
||||
inline void BitClear(uint32_t *bits, uint32_t bitMask) {
|
||||
inline void MS_API BitClear(uint32_t *bits, uint32_t bitMask) {
|
||||
if (bits == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace mindspore {
|
|||
namespace dataset {
|
||||
|
||||
/// \brief Simple class to do data manipulation, contains helper function to update json files in dataset
|
||||
class DataHelper {
|
||||
class MS_API DataHelper {
|
||||
public:
|
||||
/// \brief constructor
|
||||
DataHelper() {}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,7 @@ namespace mindspore {
|
|||
namespace dataset {
|
||||
class DeviceResource;
|
||||
// class to run tensor operations in eager mode
|
||||
class Execute {
|
||||
class MS_API Execute {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] op TensorOperation to be applied in Eager mode, it accepts operation in type of shared pointer.
|
||||
|
|
|
@ -45,7 +45,7 @@ using MSTensorMapChar = std::map<std::vector<char>, mindspore::MSTensor>;
|
|||
using MSTensorVec = std::vector<mindspore::MSTensor>;
|
||||
|
||||
// Abstract class for iterating over the dataset.
|
||||
class Iterator {
|
||||
class MS_API Iterator {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
Iterator();
|
||||
|
@ -146,7 +146,7 @@ class Iterator {
|
|||
IteratorConsumer *consumer_;
|
||||
};
|
||||
|
||||
class PullIterator : public Iterator {
|
||||
class MS_API PullIterator : public Iterator {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
PullIterator();
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "include/api/types.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace dataset {
|
||||
|
||||
|
@ -29,7 +31,7 @@ class SamplerObj;
|
|||
// Abstract class to represent a sampler in the data pipeline.
|
||||
/// \class Sampler samplers.h
|
||||
/// \brief An abstract base class to represent a sampler in the data pipeline.
|
||||
class Sampler : std::enable_shared_from_this<Sampler> {
|
||||
class MS_API Sampler : std::enable_shared_from_this<Sampler> {
|
||||
friend class AlbumDataset;
|
||||
friend class CelebADataset;
|
||||
friend class Cifar10Dataset;
|
||||
|
@ -81,7 +83,7 @@ class Sampler : std::enable_shared_from_this<Sampler> {
|
|||
|
||||
/// \brief A class to represent a Distributed Sampler in the data pipeline.
|
||||
/// \note A Sampler that accesses a shard of the dataset.
|
||||
class DistributedSampler final : public Sampler {
|
||||
class MS_API DistributedSampler final : public Sampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
@ -123,7 +125,7 @@ class DistributedSampler final : public Sampler {
|
|||
/// \brief A class to represent a PK Sampler in the data pipeline.
|
||||
/// \note Samples K elements for each P class in the dataset.
|
||||
/// This will sample all classes.
|
||||
class PKSampler final : public Sampler {
|
||||
class MS_API PKSampler final : public Sampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
@ -155,7 +157,7 @@ class PKSampler final : public Sampler {
|
|||
|
||||
/// \brief A class to represent a Random Sampler in the data pipeline.
|
||||
/// \note Samples the elements randomly.
|
||||
class RandomSampler final : public Sampler {
|
||||
class MS_API RandomSampler final : public Sampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
@ -185,7 +187,7 @@ class RandomSampler final : public Sampler {
|
|||
|
||||
/// \brief A class to represent a Sequential Sampler in the data pipeline.
|
||||
/// \note Samples the dataset elements sequentially, same as not having a sampler.
|
||||
class SequentialSampler final : public Sampler {
|
||||
class MS_API SequentialSampler final : public Sampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
@ -215,7 +217,7 @@ class SequentialSampler final : public Sampler {
|
|||
|
||||
/// \brief A class to represent a Subset Sampler in the data pipeline.
|
||||
/// \note Samples the elements from a sequence of indices.
|
||||
class SubsetSampler : public Sampler {
|
||||
class MS_API SubsetSampler : public Sampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
@ -244,7 +246,7 @@ class SubsetSampler : public Sampler {
|
|||
|
||||
/// \brief A class to represent a Subset Random Sampler in the data pipeline.
|
||||
/// \note Samples the elements randomly from a sequence of indices.
|
||||
class SubsetRandomSampler final : public SubsetSampler {
|
||||
class MS_API SubsetRandomSampler final : public SubsetSampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
@ -271,7 +273,7 @@ class SubsetRandomSampler final : public SubsetSampler {
|
|||
/// \brief A class to represent a Weighted Random Sampler in the data pipeline.
|
||||
/// \note Samples the elements from [0, len(weights) - 1] randomly with the given
|
||||
/// weights (probabilities).
|
||||
class WeightedRandomSampler final : public Sampler {
|
||||
class MS_API WeightedRandomSampler final : public Sampler {
|
||||
friend std::shared_ptr<SamplerObj> SelectSampler(int64_t, bool, int32_t, int32_t);
|
||||
|
||||
public:
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace text {
|
|||
#ifndef _WIN32
|
||||
/// \brief Tokenize a scalar tensor of UTF-8 string by specific rules.
|
||||
/// \note BasicTokenizer is not supported on the Windows platform yet.
|
||||
class BasicTokenizer final : public TensorTransform {
|
||||
class MS_API BasicTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] lower_case If true, apply CaseFold, NormalizeUTF8 (NFD mode) and RegexReplace operations to
|
||||
|
@ -81,7 +81,7 @@ class BasicTokenizer final : public TensorTransform {
|
|||
|
||||
/// \brief A tokenizer used for Bert text process.
|
||||
/// \note BertTokenizer is not supported on the Windows platform yet.
|
||||
class BertTokenizer final : public TensorTransform {
|
||||
class MS_API BertTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] vocab A Vocab object.
|
||||
|
@ -153,7 +153,7 @@ class BertTokenizer final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply case fold operation on UTF-8 string tensors.
|
||||
class CaseFold final : public TensorTransform {
|
||||
class MS_API CaseFold final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -179,7 +179,7 @@ class CaseFold final : public TensorTransform {
|
|||
|
||||
/// \brief Tokenize a Chinese string into words based on the dictionary.
|
||||
/// \note The integrity of the HMMSegment algorithm and MPSegment algorithm files must be confirmed.
|
||||
class JiebaTokenizer final : public TensorTransform {
|
||||
class MS_API JiebaTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] hmm_path Dictionary file is used by the HMMSegment algorithm. The dictionary can be obtained on the
|
||||
|
@ -291,7 +291,7 @@ class JiebaTokenizer final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Look up a word into an id according to the input vocabulary table.
|
||||
class Lookup final : public TensorTransform {
|
||||
class MS_API Lookup final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] vocab a Vocab object.
|
||||
|
@ -345,7 +345,7 @@ class Lookup final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Generate n-gram from a 1-D string Tensor.
|
||||
class Ngram final : public TensorTransform {
|
||||
class MS_API Ngram final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] ngrams ngrams is a vector of positive integers. For example, if ngrams={4, 3}, then the result
|
||||
|
@ -396,7 +396,7 @@ class Ngram final : public TensorTransform {
|
|||
|
||||
#ifndef _WIN32
|
||||
/// \brief Apply normalize operation to UTF-8 string tensors.
|
||||
class NormalizeUTF8 final : public TensorTransform {
|
||||
class MS_API NormalizeUTF8 final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] normalize_form Valid values can be any of [NormalizeForm::kNone,NormalizeForm::kNfc,
|
||||
|
@ -432,7 +432,7 @@ class NormalizeUTF8 final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Replace a UTF-8 string tensor with 'replace' according to regular expression 'pattern'.
|
||||
class RegexReplace final : public TensorTransform {
|
||||
class MS_API RegexReplace final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] pattern The regex expression patterns.
|
||||
|
@ -472,7 +472,7 @@ class RegexReplace final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Tokenize a scalar tensor of UTF-8 string by the regex expression pattern.
|
||||
class RegexTokenizer final : public TensorTransform {
|
||||
class MS_API RegexTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] delim_pattern The pattern of regex delimiters.
|
||||
|
@ -510,7 +510,7 @@ class RegexTokenizer final : public TensorTransform {
|
|||
#endif
|
||||
|
||||
/// \brief Tokenize a scalar token or a 1-D token to tokens by sentencepiece.
|
||||
class SentencePieceTokenizer final : public TensorTransform {
|
||||
class MS_API SentencePieceTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] vocab a SentencePieceVocab object.
|
||||
|
@ -566,7 +566,7 @@ class SentencePieceTokenizer final : public TensorTransform {
|
|||
|
||||
/// \brief Construct a tensor from data (only 1-D for now), where each element in the dimension
|
||||
/// axis is a slice of data starting at the corresponding position, with a specified width.
|
||||
class SlidingWindow final : public TensorTransform {
|
||||
class MS_API SlidingWindow final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] width The width of the window. It must be an integer and greater than zero.
|
||||
|
@ -601,7 +601,7 @@ class SlidingWindow final : public TensorTransform {
|
|||
/// https://en.cppreference.com/w/cpp/string/basic_string/stof,
|
||||
/// https://en.cppreference.com/w/cpp/string/basic_string/stoul,
|
||||
/// except that any strings which represent negative numbers cannot be cast to an unsigned integer type.
|
||||
class ToNumber final : public TensorTransform {
|
||||
class MS_API ToNumber final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] data_type mindspore::DataType of the tensor to be cast to. Must be a numeric type, excluding bool.
|
||||
|
@ -630,7 +630,7 @@ class ToNumber final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Truncate a pair of rank-1 tensors such that the total length is less than max_length.
|
||||
class TruncateSequencePair final : public TensorTransform {
|
||||
class MS_API TruncateSequencePair final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] max_length Maximum length required.
|
||||
|
@ -659,7 +659,7 @@ class TruncateSequencePair final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Tokenize a scalar tensor of UTF-8 string to Unicode characters.
|
||||
class UnicodeCharTokenizer final : public TensorTransform {
|
||||
class MS_API UnicodeCharTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] with_offsets whether to output offsets of tokens (default=false).
|
||||
|
@ -688,7 +688,7 @@ class UnicodeCharTokenizer final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Tokenize scalar token or 1-D tokens to 1-D sub-word tokens.
|
||||
class WordpieceTokenizer final : public TensorTransform {
|
||||
class MS_API WordpieceTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] vocab A Vocab object.
|
||||
|
@ -734,7 +734,7 @@ class WordpieceTokenizer final : public TensorTransform {
|
|||
|
||||
#ifndef _WIN32
|
||||
/// \brief Tokenize a scalar tensor of UTF-8 string on Unicode script boundaries.
|
||||
class UnicodeScriptTokenizer final : public TensorTransform {
|
||||
class MS_API UnicodeScriptTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] keep_whitespace whether to emit whitespace tokens (default=false).
|
||||
|
@ -764,7 +764,7 @@ class UnicodeScriptTokenizer final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Tokenize a scalar tensor of UTF-8 string on ICU4C defined whitespaces.
|
||||
class WhitespaceTokenizer final : public TensorTransform {
|
||||
class MS_API WhitespaceTokenizer final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] with_offsets whether to output offsets of tokens (default=false).
|
||||
|
|
|
@ -48,7 +48,7 @@ class UniformAugment;
|
|||
// Abstract class to represent a tensor transform operation in the data pipeline.
|
||||
/// \class TensorTransform transforms.h
|
||||
/// \brief A base class to represent a tensor transform operation in the data pipeline.
|
||||
class TensorTransform : public std::enable_shared_from_this<TensorTransform> {
|
||||
class MS_API TensorTransform : public std::enable_shared_from_this<TensorTransform> {
|
||||
friend class Dataset;
|
||||
friend class Execute;
|
||||
friend class transforms::Compose;
|
||||
|
@ -77,7 +77,7 @@ class TensorTransform : public std::enable_shared_from_this<TensorTransform> {
|
|||
};
|
||||
|
||||
/// \brief Slice object used in SliceOption.
|
||||
class Slice {
|
||||
class MS_API Slice {
|
||||
public:
|
||||
/// \brief Constructor, with start, stop and step default to 0.
|
||||
Slice() : start_(0), stop_(0), step_(0) {}
|
||||
|
@ -104,7 +104,7 @@ class Slice {
|
|||
};
|
||||
|
||||
/// \brief SliceOption used in Slice TensorTransform.
|
||||
class SliceOption {
|
||||
class MS_API SliceOption {
|
||||
public:
|
||||
/// \param[in] all Slice the whole dimension
|
||||
explicit SliceOption(bool all) : all_(all) {}
|
||||
|
@ -128,7 +128,7 @@ class SliceOption {
|
|||
namespace transforms {
|
||||
|
||||
/// \brief Compose a list of transforms into a single transform.
|
||||
class Compose final : public TensorTransform {
|
||||
class MS_API Compose final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] transforms A vector of raw pointers to TensorTransform objects to be applied.
|
||||
|
@ -191,7 +191,7 @@ class Compose final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Concatenate all tensors into a single tensor.
|
||||
class Concatenate final : public TensorTransform {
|
||||
class MS_API Concatenate final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] axis Concatenate the tensors along given axis, only support 0 or -1 so far (default=0).
|
||||
|
@ -225,7 +225,7 @@ class Concatenate final : public TensorTransform {
|
|||
|
||||
/// \brief Duplicate the input tensor to a new output tensor.
|
||||
/// The input tensor is carried over to the output list.
|
||||
class Duplicate final : public TensorTransform {
|
||||
class MS_API Duplicate final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -251,7 +251,7 @@ class Duplicate final : public TensorTransform {
|
|||
|
||||
/// \brief 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 {
|
||||
class MS_API Fill final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] fill_value Scalar value to fill the tensor with.
|
||||
|
@ -284,7 +284,7 @@ class Fill final : public TensorTransform {
|
|||
|
||||
/// \brief 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 {
|
||||
class MS_API Mask final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] op One of the relational operators: EQ, NE LT, GT, LE or GE.
|
||||
|
@ -319,7 +319,7 @@ class Mask final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Convert the labels into OneHot format.
|
||||
class OneHot final : public TensorTransform {
|
||||
class MS_API OneHot final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] num_classes number of classes.
|
||||
|
@ -349,7 +349,7 @@ class OneHot final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Pad input tensor according to pad_shape
|
||||
class PadEnd final : public TensorTransform {
|
||||
class MS_API PadEnd final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] pad_shape List of integers representing the shape needed, need to have same rank with input tensor.
|
||||
|
@ -382,7 +382,7 @@ class PadEnd final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly perform a series of transforms with a given probability.
|
||||
class RandomApply final : public TensorTransform {
|
||||
class MS_API RandomApply final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] transforms A vector of raw pointers to TensorTransform objects to be applied.
|
||||
|
@ -448,7 +448,7 @@ class RandomApply final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly select one transform from a list of transforms to perform on the input tensor.
|
||||
class RandomChoice final : public TensorTransform {
|
||||
class MS_API RandomChoice final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] transforms A vector of raw pointers to TensorTransform objects to be applied.
|
||||
|
@ -513,7 +513,7 @@ class RandomChoice final : public TensorTransform {
|
|||
/// \brief Extract a tensor out using the given n slices.
|
||||
/// The functionality of Slice is similar to the feature of indexing of NumPy.
|
||||
/// (Currently only rank-1 tensors are supported).
|
||||
class Slice final : public TensorTransform {
|
||||
class MS_API Slice final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] slice_input Vector of SliceOption.
|
||||
|
@ -543,7 +543,7 @@ class Slice final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Cast the MindSpore data type of a tensor to another.
|
||||
class TypeCast final : public TensorTransform {
|
||||
class MS_API TypeCast final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] data_type mindspore::DataType to be cast to.
|
||||
|
@ -573,7 +573,7 @@ class TypeCast final : public TensorTransform {
|
|||
|
||||
/// \brief Return an output tensor that contains all the unique elements of the input tensor in
|
||||
/// the same order as they appear in the input tensor.
|
||||
class Unique final : public TensorTransform {
|
||||
class MS_API Unique final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace vision {
|
|||
|
||||
/// \brief AdjustGamma TensorTransform.
|
||||
/// \note Apply gamma correction on input image.
|
||||
class AdjustGamma final : public TensorTransform {
|
||||
class MS_API AdjustGamma final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] gamma Non negative real number, which makes the output image pixel value
|
||||
|
@ -71,7 +71,7 @@ class AdjustGamma final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply AutoAugment data augmentation method.
|
||||
class AutoAugment final : public TensorTransform {
|
||||
class MS_API AutoAugment final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] policy An enum for the data auto augmentation policy (default=AutoAugmentPolicy::kImageNet).
|
||||
|
@ -111,7 +111,7 @@ class AutoAugment final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply automatic contrast on the input image.
|
||||
class AutoContrast final : public TensorTransform {
|
||||
class MS_API AutoContrast final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] cutoff Percent of pixels to cut off from the histogram, the valid range of cutoff value is 0 to 50.
|
||||
|
@ -143,7 +143,7 @@ class AutoContrast final : public TensorTransform {
|
|||
|
||||
/// \brief BoundingBoxAugment TensorTransform.
|
||||
/// \note Apply a given image transform on a random selection of bounding box regions of a given image.
|
||||
class BoundingBoxAugment final : public TensorTransform {
|
||||
class MS_API BoundingBoxAugment final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] transform Raw pointer to the TensorTransform operation.
|
||||
|
@ -204,7 +204,7 @@ class BoundingBoxAugment final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Change the color space of the image.
|
||||
class ConvertColor final : public TensorTransform {
|
||||
class MS_API ConvertColor final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] convert_mode The mode of image channel conversion.
|
||||
|
@ -232,7 +232,7 @@ class ConvertColor final : public TensorTransform {
|
|||
|
||||
/// \brief Mask a random section of each image with the corresponding part of another randomly
|
||||
/// selected image in that batch.
|
||||
class CutMixBatch final : public TensorTransform {
|
||||
class MS_API CutMixBatch final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] image_batch_format The format of the batch.
|
||||
|
@ -261,7 +261,7 @@ class CutMixBatch final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly cut (mask) out a given number of square patches from the input image.
|
||||
class CutOut final : public TensorTransform {
|
||||
class MS_API CutOut final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] length Integer representing the side length of each square patch.
|
||||
|
@ -289,7 +289,7 @@ class CutOut final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply histogram equalization on the input image.
|
||||
class Equalize final : public TensorTransform {
|
||||
class MS_API Equalize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -311,7 +311,7 @@ class Equalize final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Flip the input image horizontally.
|
||||
class HorizontalFlip final : public TensorTransform {
|
||||
class MS_API HorizontalFlip final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -333,7 +333,7 @@ class HorizontalFlip final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Transpose the input image; shape (H, W, C) to shape (C, H, W).
|
||||
class HWC2CHW final : public TensorTransform {
|
||||
class MS_API HWC2CHW final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -355,7 +355,7 @@ class HWC2CHW final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply invert on the input image in RGB mode.
|
||||
class Invert final : public TensorTransform {
|
||||
class MS_API Invert final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -378,7 +378,7 @@ class Invert final : public TensorTransform {
|
|||
|
||||
/// \brief 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 {
|
||||
class MS_API MixUpBatch final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] alpha hyperparameter of beta distribution (default = 1.0).
|
||||
|
@ -406,7 +406,7 @@ class MixUpBatch final : public TensorTransform {
|
|||
|
||||
/// \brief Normalize the input image with respect to mean and standard deviation and pads an extra
|
||||
/// channel with value zero.
|
||||
class NormalizePad final : public TensorTransform {
|
||||
class MS_API NormalizePad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] mean A vector of mean values for each channel, with respect to channel order.
|
||||
|
@ -444,7 +444,7 @@ class NormalizePad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Pad the image according to padding parameters.
|
||||
class Pad final : public TensorTransform {
|
||||
class MS_API Pad final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] padding A vector representing the number of pixels to pad the image.
|
||||
|
@ -490,7 +490,7 @@ class Pad final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Automatically adjust the contrast of the image with a given probability.
|
||||
class RandomAutoContrast final : public TensorTransform {
|
||||
class MS_API RandomAutoContrast final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] cutoff Percent of the lightest and darkest pixels to be cut off from
|
||||
|
@ -525,7 +525,7 @@ class RandomAutoContrast final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly adjust the sharpness of the input image with a given probability.
|
||||
class RandomAdjustSharpness final : public TensorTransform {
|
||||
class MS_API RandomAdjustSharpness final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] degree A float representing sharpness adjustment degree, which must be non negative.
|
||||
|
@ -559,7 +559,7 @@ class RandomAdjustSharpness final : public TensorTransform {
|
|||
/// \brief Blend 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 to the bound of the interval.
|
||||
class RandomColor final : public TensorTransform {
|
||||
class MS_API RandomColor final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] t_lb Lower bound random weights.
|
||||
|
@ -590,7 +590,7 @@ class RandomColor final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly adjust the brightness, contrast, saturation, and hue of the input image.
|
||||
class RandomColorAdjust final : public TensorTransform {
|
||||
class MS_API RandomColorAdjust final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] brightness Brightness adjustment factor. Must be a vector of one or two values
|
||||
|
@ -629,7 +629,7 @@ class RandomColorAdjust final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Crop the input image at a random location.
|
||||
class RandomCrop final : public TensorTransform {
|
||||
class MS_API RandomCrop final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the cropped image.
|
||||
|
@ -681,7 +681,7 @@ class RandomCrop final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Equivalent to RandomResizedCrop TensorTransform, but crop the image before decoding.
|
||||
class RandomCropDecodeResize final : public TensorTransform {
|
||||
class MS_API RandomCropDecodeResize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the cropped image.
|
||||
|
@ -728,7 +728,7 @@ class RandomCropDecodeResize final : public TensorTransform {
|
|||
|
||||
/// \brief Crop the input image at a random location and adjust bounding boxes accordingly.
|
||||
/// If the cropped area is out of bbox, the returned bbox will be empty.
|
||||
class RandomCropWithBBox final : public TensorTransform {
|
||||
class MS_API RandomCropWithBBox final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the cropped image.
|
||||
|
@ -778,7 +778,7 @@ class RandomCropWithBBox final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly apply histogram equalization on the input image with a given probability.
|
||||
class RandomEqualize final : public TensorTransform {
|
||||
class MS_API RandomEqualize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] prob A float representing the probability of equalization, which
|
||||
|
@ -809,7 +809,7 @@ class RandomEqualize final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly flip the input image horizontally with a given probability.
|
||||
class RandomHorizontalFlip final : public TensorTransform {
|
||||
class MS_API RandomHorizontalFlip final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] prob A float representing the probability of flip.
|
||||
|
@ -839,7 +839,7 @@ class RandomHorizontalFlip final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly flip the input image horizontally with a given probability and adjust bounding boxes accordingly.
|
||||
class RandomHorizontalFlipWithBBox final : public TensorTransform {
|
||||
class MS_API RandomHorizontalFlipWithBBox final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] prob A float representing the probability of flip.
|
||||
|
@ -868,7 +868,7 @@ class RandomHorizontalFlipWithBBox final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly invert the input image with a given probability.
|
||||
class RandomInvert final : public TensorTransform {
|
||||
class MS_API RandomInvert final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] prob A float representing the probability of the image being inverted, which
|
||||
|
@ -899,7 +899,7 @@ class RandomInvert final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Add AlexNet-style PCA-based noise to an image.
|
||||
class RandomLighting final : public TensorTransform {
|
||||
class MS_API RandomLighting final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] alpha A float representing the intensity of the image (default=0.05).
|
||||
|
@ -929,7 +929,7 @@ class RandomLighting final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Reduce the number of bits for each color channel randomly.
|
||||
class RandomPosterize final : public TensorTransform {
|
||||
class MS_API RandomPosterize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] bit_range Range of random posterize to compress image.
|
||||
|
@ -960,7 +960,7 @@ class RandomPosterize final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Resize the input image using a randomly selected interpolation mode.
|
||||
class RandomResize final : public TensorTransform {
|
||||
class MS_API RandomResize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the resized image.
|
||||
|
@ -993,7 +993,7 @@ class RandomResize final : public TensorTransform {
|
|||
|
||||
/// \brief Resize the input image using a randomly selected interpolation mode and adjust
|
||||
/// bounding boxes accordingly.
|
||||
class RandomResizeWithBBox final : public TensorTransform {
|
||||
class MS_API RandomResizeWithBBox final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the resized image.
|
||||
|
@ -1024,7 +1024,7 @@ class RandomResizeWithBBox final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Crop the input image to a random size and aspect ratio.
|
||||
class RandomResizedCrop final : public TensorTransform {
|
||||
class MS_API RandomResizedCrop final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the cropped image.
|
||||
|
@ -1072,7 +1072,7 @@ class RandomResizedCrop final : public TensorTransform {
|
|||
|
||||
/// \brief 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 {
|
||||
class MS_API RandomResizedCropWithBBox final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the cropped image.
|
||||
|
@ -1117,7 +1117,7 @@ class RandomResizedCropWithBBox final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Rotate the image according to parameters.
|
||||
class RandomRotation final : public TensorTransform {
|
||||
class MS_API RandomRotation final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] degrees A float vector of size 2, representing the starting and ending degrees.
|
||||
|
@ -1163,7 +1163,7 @@ class RandomRotation final : public TensorTransform {
|
|||
/// (operation, prob), where operation is a TensorTransform operation and prob is the probability that this
|
||||
/// operation will be applied. Once a sub-policy is selected, each operation within the sub-policy with be
|
||||
/// applied in sequence according to its probability.
|
||||
class RandomSelectSubpolicy final : public TensorTransform {
|
||||
class MS_API 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.
|
||||
|
@ -1234,7 +1234,7 @@ class RandomSelectSubpolicy final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Adjust the sharpness of the input image by a fixed or random degree.
|
||||
class RandomSharpness final : public TensorTransform {
|
||||
class MS_API RandomSharpness final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] degrees A float vector of size 2, representing the range of random sharpness
|
||||
|
@ -1266,7 +1266,7 @@ class RandomSharpness final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Invert pixels randomly within a specified range.
|
||||
class RandomSolarize final : public TensorTransform {
|
||||
class MS_API RandomSolarize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] threshold A vector with two elements specifying the pixel range to invert.
|
||||
|
@ -1298,7 +1298,7 @@ class RandomSolarize final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly flip the input image vertically with a given probability.
|
||||
class RandomVerticalFlip final : public TensorTransform {
|
||||
class MS_API RandomVerticalFlip final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] prob A float representing the probability of flip.
|
||||
|
@ -1328,7 +1328,7 @@ class RandomVerticalFlip final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly flip the input image vertically with a given probability and adjust bounding boxes accordingly.
|
||||
class RandomVerticalFlipWithBBox final : public TensorTransform {
|
||||
class MS_API RandomVerticalFlipWithBBox final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] prob A float representing the probability of flip.
|
||||
|
@ -1357,7 +1357,7 @@ class RandomVerticalFlipWithBBox final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Rescale the pixel value of input image.
|
||||
class Rescale final : public TensorTransform {
|
||||
class MS_API Rescale final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] rescale Rescale factor.
|
||||
|
@ -1388,7 +1388,7 @@ class Rescale final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Resize the input image to the given size and adjust bounding boxes accordingly.
|
||||
class ResizeWithBBox final : public TensorTransform {
|
||||
class MS_API ResizeWithBBox final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size The output size of the resized image.
|
||||
|
@ -1425,7 +1425,7 @@ class ResizeWithBBox final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Change the format of input tensor from 4-channel RGBA to 3-channel BGR.
|
||||
class RGBA2BGR final : public TensorTransform {
|
||||
class MS_API RGBA2BGR final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -1450,7 +1450,7 @@ class RGBA2BGR final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Change the input 4 channel RGBA tensor to 3 channel RGB.
|
||||
class RGBA2RGB final : public TensorTransform {
|
||||
class MS_API RGBA2RGB final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -1475,7 +1475,7 @@ class RGBA2RGB final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \note Slice the tensor to multiple patches in horizontal and vertical directions.
|
||||
class SlicePatches final : public TensorTransform {
|
||||
class MS_API SlicePatches final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] num_height The number of patches in vertical direction (default=1).
|
||||
|
@ -1516,7 +1516,7 @@ class SlicePatches final : public TensorTransform {
|
|||
/// 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 be in the range [1/32, 16].
|
||||
/// Only images with an even resolution can be output. The output of odd resolution is not supported.
|
||||
class SoftDvppDecodeRandomCropResizeJpeg final : public TensorTransform {
|
||||
class MS_API SoftDvppDecodeRandomCropResizeJpeg final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the resized image.
|
||||
|
@ -1561,7 +1561,7 @@ class SoftDvppDecodeRandomCropResizeJpeg final : public TensorTransform {
|
|||
/// and 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 be in the range [1/32, 16].
|
||||
/// Only images with an even resolution can be output. The output of odd resolution is not supported.
|
||||
class SoftDvppDecodeResizeJpeg final : public TensorTransform {
|
||||
class MS_API SoftDvppDecodeResizeJpeg final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the resized image.
|
||||
|
@ -1592,7 +1592,7 @@ class SoftDvppDecodeResizeJpeg final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Swap the red and blue channels of the input image.
|
||||
class SwapRedBlue final : public TensorTransform {
|
||||
class MS_API SwapRedBlue final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -1617,7 +1617,7 @@ class SwapRedBlue final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Randomly perform transformations, as selected from input transform list, on the input tensor.
|
||||
class UniformAugment final : public TensorTransform {
|
||||
class MS_API UniformAugment final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] transforms Raw pointer to vector of TensorTransform operations.
|
||||
|
@ -1684,7 +1684,7 @@ class UniformAugment final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Flip the input image vertically.
|
||||
class VerticalFlip final : public TensorTransform {
|
||||
class MS_API VerticalFlip final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace vision {
|
|||
|
||||
/// \brief Decode and resize JPEG image using the hardware algorithm of
|
||||
/// Ascend series chip DVPP module.
|
||||
class DvppDecodeResizeJpeg final : public TensorTransform {
|
||||
class MS_API DvppDecodeResizeJpeg final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] resize Parameter vector of two integers for each dimension, with respect to H,W order.
|
||||
|
@ -68,7 +68,7 @@ class DvppDecodeResizeJpeg final : public TensorTransform {
|
|||
|
||||
/// \brief Decode, resize and crop JPEG image using the hardware algorithm of
|
||||
/// Ascend series chip DVPP module.
|
||||
class DvppDecodeResizeCropJpeg final : public TensorTransform {
|
||||
class MS_API DvppDecodeResizeCropJpeg final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] crop Parameter vector of two integers for each dimension after final crop, with respect to H,W order.
|
||||
|
@ -101,7 +101,7 @@ class DvppDecodeResizeCropJpeg final : public TensorTransform {
|
|||
|
||||
/// \brief Decode PNG image using the hardware algorithm of
|
||||
/// Ascend series chip DVPP module.
|
||||
class DvppDecodePng final : public TensorTransform {
|
||||
class MS_API DvppDecodePng final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace vision {
|
|||
class RotateOperation;
|
||||
|
||||
/// \brief Apply affine transform on the input image.
|
||||
class Affine final : public TensorTransform {
|
||||
class MS_API Affine final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] degrees The degrees to rotate the image.
|
||||
|
@ -80,7 +80,7 @@ class Affine final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Crop the input image at the center to the given size.
|
||||
class CenterCrop final : public TensorTransform {
|
||||
class MS_API CenterCrop final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the cropped image.
|
||||
|
@ -114,7 +114,7 @@ class CenterCrop final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Crop an image based on location and crop size.
|
||||
class Crop final : public TensorTransform {
|
||||
class MS_API 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}.
|
||||
|
@ -147,7 +147,7 @@ class Crop final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Decode the input image in RGB mode.
|
||||
class Decode final : public TensorTransform {
|
||||
class MS_API Decode final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] rgb A boolean indicating whether to decode the image in RGB mode or not.
|
||||
|
@ -178,7 +178,7 @@ class Decode final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Blur the input image with the specified Gaussian kernel.
|
||||
class GaussianBlur final : public TensorTransform {
|
||||
class MS_API GaussianBlur final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] kernel_size A vector of Gaussian kernel size for width and height. The value must be positive and odd.
|
||||
|
@ -210,7 +210,7 @@ class GaussianBlur final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Normalize the input image with respect to mean and standard deviation.
|
||||
class Normalize final : public TensorTransform {
|
||||
class MS_API Normalize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] mean A vector of mean values for each channel, with respect to channel order.
|
||||
|
@ -245,7 +245,7 @@ class Normalize final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Apply a Random Affine transformation on the input image in RGB or Greyscale mode.
|
||||
class RandomAffine final : public TensorTransform {
|
||||
class MS_API RandomAffine final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] degrees A float vector of size 2, representing the starting and ending degree.
|
||||
|
@ -296,7 +296,7 @@ class RandomAffine final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Resize the input image to the given size.
|
||||
class Resize final : public TensorTransform {
|
||||
class MS_API Resize final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] size A vector representing the output size of the resized image.
|
||||
|
@ -336,7 +336,7 @@ class Resize final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Keep the original picture ratio and fills the rest.
|
||||
class ResizePreserveAR final : public TensorTransform {
|
||||
class MS_API ResizePreserveAR final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \param[in] height The height of image output value after resizing.
|
||||
|
@ -377,7 +377,7 @@ class ResizePreserveAR final : public TensorTransform {
|
|||
|
||||
/// \brief RGB2BGR TensorTransform.
|
||||
/// \notes Convert the format of input image from RGB to BGR.
|
||||
class RGB2BGR final : public TensorTransform {
|
||||
class MS_API RGB2BGR final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -404,7 +404,7 @@ class RGB2BGR final : public TensorTransform {
|
|||
/// \brief RGB2GRAY TensorTransform.
|
||||
/// \note Convert RGB image or color image to grayscale image.
|
||||
/// \brief Convert a RGB image or color image to a grayscale one.
|
||||
class RGB2GRAY final : public TensorTransform {
|
||||
class MS_API RGB2GRAY final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \par Example
|
||||
|
@ -429,7 +429,7 @@ class RGB2GRAY final : public TensorTransform {
|
|||
};
|
||||
|
||||
/// \brief Rotate the input image according to parameters.
|
||||
class Rotate final : public TensorTransform {
|
||||
class MS_API Rotate final : public TensorTransform {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \note This api is only used in Lite, the interpolation mode is bilinear.
|
||||
|
|
|
@ -63,7 +63,7 @@ class DSCallback;
|
|||
|
||||
/// \class Dataset datasets.h
|
||||
/// \brief A base class to represent a dataset in the data pipeline.
|
||||
class Dataset : public std::enable_shared_from_this<Dataset> {
|
||||
class MS_API Dataset : public std::enable_shared_from_this<Dataset> {
|
||||
public:
|
||||
// need friend class so they can access the children_ field
|
||||
friend class Iterator;
|
||||
|
@ -388,7 +388,7 @@ class Dataset : public std::enable_shared_from_this<Dataset> {
|
|||
bool SaveCharIF(const std::vector<char> &dataset_path, int32_t num_files, const std::vector<char> &dataset_type);
|
||||
};
|
||||
|
||||
class SchemaObj {
|
||||
class MS_API SchemaObj {
|
||||
public:
|
||||
/// \brief Constructor
|
||||
explicit SchemaObj(const std::string &schema_file = "") : SchemaObj(StringToChar(schema_file)) {}
|
||||
|
@ -490,13 +490,13 @@ class SchemaObj {
|
|||
std::shared_ptr<Data> data_;
|
||||
};
|
||||
|
||||
class BatchDataset : public Dataset {
|
||||
class MS_API BatchDataset : public Dataset {
|
||||
public:
|
||||
BatchDataset(std::shared_ptr<Dataset> input, int32_t batch_size, bool drop_remainder = false);
|
||||
~BatchDataset() = default;
|
||||
};
|
||||
|
||||
class MapDataset : public Dataset {
|
||||
class MS_API MapDataset : public Dataset {
|
||||
public:
|
||||
MapDataset(std::shared_ptr<Dataset> input, std::vector<std::shared_ptr<TensorOperation>> operations,
|
||||
const std::vector<std::vector<char>> &input_columns, const std::vector<std::vector<char>> &output_columns,
|
||||
|
@ -505,13 +505,13 @@ class MapDataset : public Dataset {
|
|||
~MapDataset() = default;
|
||||
};
|
||||
|
||||
class ProjectDataset : public Dataset {
|
||||
class MS_API ProjectDataset : public Dataset {
|
||||
public:
|
||||
ProjectDataset(std::shared_ptr<Dataset> input, const std::vector<std::vector<char>> &columns);
|
||||
~ProjectDataset() = default;
|
||||
};
|
||||
|
||||
class ShuffleDataset : public Dataset {
|
||||
class MS_API ShuffleDataset : public Dataset {
|
||||
public:
|
||||
ShuffleDataset(std::shared_ptr<Dataset> input, int32_t buffer_size);
|
||||
~ShuffleDataset() = default;
|
||||
|
@ -522,16 +522,16 @@ class ShuffleDataset : public Dataset {
|
|||
/// \note The reason for using this API is that std::string will be constrained by the
|
||||
/// compiler option '_GLIBCXX_USE_CXX11_ABI' while char is free of this restriction.
|
||||
/// \return Shared pointer to the current schema.
|
||||
std::shared_ptr<SchemaObj> SchemaCharIF(const std::vector<char> &schema_file);
|
||||
std::shared_ptr<SchemaObj> MS_API SchemaCharIF(const std::vector<char> &schema_file);
|
||||
|
||||
/// \brief Function to create a SchemaObj.
|
||||
/// \param[in] schema_file Path of schema file.
|
||||
/// \return Shared pointer to the current schema.
|
||||
inline std::shared_ptr<SchemaObj> Schema(const std::string &schema_file = "") {
|
||||
inline std::shared_ptr<SchemaObj> MS_API Schema(const std::string &schema_file = "") {
|
||||
return SchemaCharIF(StringToChar(schema_file));
|
||||
}
|
||||
|
||||
class AlbumDataset : public Dataset {
|
||||
class MS_API AlbumDataset : public Dataset {
|
||||
public:
|
||||
/// \brief Constructor of AlbumDataset.
|
||||
/// \param[in] dataset_dir Path to the root directory that contains the dataset.
|
||||
|
@ -599,10 +599,10 @@ class AlbumDataset : public Dataset {
|
|||
/// /* Note: As we defined before, each data dictionary owns keys "image", "label" and "id" */
|
||||
/// auto image = row["image"];
|
||||
/// \endcode
|
||||
inline std::shared_ptr<AlbumDataset> Album(const std::string &dataset_dir, const std::string &data_schema,
|
||||
const std::vector<std::string> &column_names = {}, bool decode = false,
|
||||
const std::shared_ptr<Sampler> &sampler = std::make_shared<RandomSampler>(),
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
inline std::shared_ptr<AlbumDataset> MS_API
|
||||
Album(const std::string &dataset_dir, const std::string &data_schema, const std::vector<std::string> &column_names = {},
|
||||
bool decode = false, const std::shared_ptr<Sampler> &sampler = std::make_shared<RandomSampler>(),
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
return std::make_shared<AlbumDataset>(StringToChar(dataset_dir), StringToChar(data_schema),
|
||||
VectorStringToChar(column_names), decode, sampler, cache);
|
||||
}
|
||||
|
@ -615,10 +615,10 @@ inline std::shared_ptr<AlbumDataset> Album(const std::string &dataset_dir, const
|
|||
/// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset.
|
||||
/// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used).
|
||||
/// \return Shared pointer to the current Dataset
|
||||
inline std::shared_ptr<AlbumDataset> Album(const std::string &dataset_dir, const std::string &data_schema,
|
||||
const std::vector<std::string> &column_names, bool decode,
|
||||
const Sampler *sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
inline std::shared_ptr<AlbumDataset> MS_API Album(const std::string &dataset_dir, const std::string &data_schema,
|
||||
const std::vector<std::string> &column_names, bool decode,
|
||||
const Sampler *sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
return std::make_shared<AlbumDataset>(StringToChar(dataset_dir), StringToChar(data_schema),
|
||||
VectorStringToChar(column_names), decode, sampler, cache);
|
||||
}
|
||||
|
@ -631,15 +631,15 @@ inline std::shared_ptr<AlbumDataset> Album(const std::string &dataset_dir, const
|
|||
/// \param[in] sampler Sampler object used to choose samples from the dataset.
|
||||
/// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used).
|
||||
/// \return Shared pointer to the current Dataset
|
||||
inline std::shared_ptr<AlbumDataset> Album(const std::string &dataset_dir, const std::string &data_schema,
|
||||
const std::vector<std::string> &column_names, bool decode,
|
||||
const std::reference_wrapper<Sampler> sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
inline std::shared_ptr<AlbumDataset> MS_API Album(const std::string &dataset_dir, const std::string &data_schema,
|
||||
const std::vector<std::string> &column_names, bool decode,
|
||||
const std::reference_wrapper<Sampler> sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
return std::make_shared<AlbumDataset>(StringToChar(dataset_dir), StringToChar(data_schema),
|
||||
VectorStringToChar(column_names), decode, sampler, cache);
|
||||
}
|
||||
|
||||
class MnistDataset : public Dataset {
|
||||
class MS_API MnistDataset : public Dataset {
|
||||
public:
|
||||
/// \brief Constructor of MnistDataset.
|
||||
/// \param[in] dataset_dir Path to the root directory that contains the dataset.
|
||||
|
@ -692,9 +692,10 @@ class MnistDataset : public Dataset {
|
|||
/// /* Note: In MNIST dataset, each dictionary has keys "image" and "label" */
|
||||
/// auto image = row["image"];
|
||||
/// \endcode
|
||||
inline std::shared_ptr<MnistDataset> Mnist(const std::string &dataset_dir, const std::string &usage = "all",
|
||||
const std::shared_ptr<Sampler> &sampler = std::make_shared<RandomSampler>(),
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
inline std::shared_ptr<MnistDataset> MS_API
|
||||
Mnist(const std::string &dataset_dir, const std::string &usage = "all",
|
||||
const std::shared_ptr<Sampler> &sampler = std::make_shared<RandomSampler>(),
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
return std::make_shared<MnistDataset>(StringToChar(dataset_dir), StringToChar(usage), sampler, cache);
|
||||
}
|
||||
|
||||
|
@ -705,9 +706,9 @@ inline std::shared_ptr<MnistDataset> Mnist(const std::string &dataset_dir, const
|
|||
/// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset.
|
||||
/// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used).
|
||||
/// \return Shared pointer to the current MnistDataset
|
||||
inline std::shared_ptr<MnistDataset> Mnist(const std::string &dataset_dir, const std::string &usage,
|
||||
const Sampler *sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
inline std::shared_ptr<MnistDataset> MS_API Mnist(const std::string &dataset_dir, const std::string &usage,
|
||||
const Sampler *sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
return std::make_shared<MnistDataset>(StringToChar(dataset_dir), StringToChar(usage), sampler, cache);
|
||||
}
|
||||
|
||||
|
@ -718,9 +719,9 @@ inline std::shared_ptr<MnistDataset> Mnist(const std::string &dataset_dir, const
|
|||
/// \param[in] sampler Sampler object used to choose samples from the dataset.
|
||||
/// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used).
|
||||
/// \return Shared pointer to the current MnistDataset
|
||||
inline std::shared_ptr<MnistDataset> Mnist(const std::string &dataset_dir, const std::string &usage,
|
||||
const std::reference_wrapper<Sampler> sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
inline std::shared_ptr<MnistDataset> MS_API Mnist(const std::string &dataset_dir, const std::string &usage,
|
||||
const std::reference_wrapper<Sampler> sampler,
|
||||
const std::shared_ptr<DatasetCache> &cache = nullptr) {
|
||||
return std::make_shared<MnistDataset>(StringToChar(dataset_dir), StringToChar(usage), sampler, cache);
|
||||
}
|
||||
} // namespace dataset
|
||||
|
|
Loading…
Reference in New Issue