258 {
259 try {
261 DataStructureInfo structure_info = info;
262
263 std::vector<std::span<const double>>
channels;
264 channels.reserve(numeric_data.size());
265 for (auto& s : numeric_data)
267
268 std::vector<std::vector<double>> extracted_data;
269
271
274 this->template get_parameter_or_default<double>("energy_threshold", 0.1),
276 break;
277
280 this->template get_parameter_or_default<double>("threshold", 0.1),
281 this->template get_parameter_or_default<double>("min_distance", 10.0),
282 this->template get_parameter_or_default<uint32_t>("region_size", 256));
283 break;
284
287 this->template get_parameter_or_default<double>("std_dev_threshold", 2.0),
289 break;
290
293 this->template get_parameter_or_default<double>("spectral_threshold", 0.1),
295 break;
296
299 this->template get_parameter_or_default<double>("mean_multiplier", 1.5),
301 break;
302
306 this->template get_parameter_or_default<double>("overlap", 0.5));
307 break;
308
311 this->template get_parameter_or_default<double>("threshold", 0.0),
312 this->template get_parameter_or_default<double>("min_distance", 1.0),
313 this->template get_parameter_or_default<uint32_t>("region_size", 1));
314 break;
315
318 this->template get_parameter_or_default<double>("silence_threshold", 0.01),
319 this->template get_parameter_or_default<uint32_t>("min_duration", 1024),
321 break;
322
325 this->template get_parameter_or_default<double>("threshold", 0.3),
326 this->template get_parameter_or_default<uint32_t>("region_size", 512),
327 this->template get_parameter_or_default<uint32_t>("fft_window_size", 1024),
329 break;
330
331 default:
333 }
334
335 output_type output = this->convert_result(extracted_data, structure_info);
336
337 output.template set_metadata<std::string>("extractor_type", "FeatureExtractor");
339 output.template set_metadata<uint32_t>(
"window_size",
static_cast<uint32_t
>(
m_window_size));
340 output.template set_metadata<uint32_t>(
"hop_size",
static_cast<uint32_t
>(
m_hop_size));
341 output.template set_metadata<size_t>("extracted_samples", extracted_data.size());
342
343 return output;
344
345 } catch (const std::exception& e) {
348 }
349 }
#define MF_ERROR(comp, ctx,...)
Core::GlobalInputConfig input
static std::tuple< std::vector< std::span< double > >, DataStructureInfo > extract_structured_double(T &compute_data)
Extract structured double data from Datum container or direct ComputeData with automatic container ha...
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::vector< Keypoint > extract_peaks(std::span< const float > response, uint32_t w, uint32_t h, float threshold, uint32_t nms_radius)
Extract peaks from a response map via non-maximum suppression.
std::vector< std::vector< double > > extract_high_energy(const std::vector< std::span< const double > > &channels, double energy_threshold, uint32_t window_size, uint32_t hop_size)
std::vector< std::vector< double > > extract_zero_crossings(const std::vector< std::span< const double > > &channels, double threshold, double min_distance, uint32_t region_size)
std::vector< std::vector< double > > extract_outliers(const std::vector< std::span< const double > > &channels, double std_dev_threshold, uint32_t window_size, uint32_t hop_size)
std::vector< std::vector< double > > extract_silence(const std::vector< std::span< const double > > &channels, double silence_threshold, uint32_t min_duration, uint32_t window_size, uint32_t hop_size)
@ ABOVE_MEAN_DATA
Extract data above statistical mean.
@ SILENCE_DATA
Extract actual silent regions.
@ PEAK_DATA
Extract data around detected peaks.
@ OUTLIER_DATA
Extract data from statistical outlier regions.
@ ZERO_CROSSING_DATA
Extract actual data at zero crossing points.
@ HIGH_ENERGY_DATA
Extract data from high-energy regions.
@ HIGH_SPECTRAL_DATA
Extract data from high spectral energy regions.
@ OVERLAPPING_WINDOWS
Extract overlapping windowed data.
@ ONSET_DATA
Extract actual onset/transient regions.
std::vector< std::vector< double > > extract_onsets(const std::vector< std::span< const double > > &channels, double threshold, uint32_t region_size, uint32_t fft_window_size, uint32_t hop_size)
std::vector< std::vector< double > > extract_high_spectral(const std::vector< std::span< const double > > &channels, double spectral_threshold, uint32_t window_size, uint32_t hop_size)
std::vector< std::vector< double > > extract_overlapping_windows(const std::vector< std::span< const double > > &channels, uint32_t window_size, double overlap)
std::vector< std::vector< double > > extract_above_mean(const std::vector< std::span< const double > > &channels, double mean_multiplier, uint32_t window_size, uint32_t hop_size)