'
Научный журнал «Вестник науки»

Режим работы с 09:00 по 23:00

zhurnal@vestnik-nauki.com

Информационное письмо

  1. Главная
  2. Архив
  3. Вестник науки №12 (69) том 1
  4. Научная статья № 121

Просмотры  12 просмотров

Zholud L.I., Shevaldysheva E.Z.

  


IMPLEMENTATION OF THE SEGMENTATION METHOD BY FITTING SIGNAL SHAPE IN PYTHON *

  


Аннотация:
the algorithm for signal segmentation using shape fitting is explored and implemented as code in the Python software product   

Ключевые слова:
signal segmentation, shape similarity, librosa library, matplotlib library, audio analysis, signal shaping   


УДК 004  

Zholud L.I.

Postgraduate student at the Department of Electronic Computing Systems

 Belarusian State University of Informatics and Radioelectronics

(Minsk, Belarus)

 

Shevaldysheva E.Z.

Candidate of Science, Philology, Associate Professor of the

Department of Intercultural Professional Communications

Belarusian State University of Informatics and Radioelectronics

(Minsk, Belarus)

 

IMPLEMENTATION OF THE SEGMENTATION

METHOD BY FIING SIGNAL SHAPE IN PYTHON

 

Abstract: the algorithm for signal segmentation using shape fitting is explored and implemented as code in the Python software product.

 

Keywords: signal segmentation, shape similarity, librosa library, matplotlib library, audio analysis, signal shaping.

 

The method of signal shape fitting segmentation is used to divide time series into separate segments based on the similarity of the signal shape. This method is based on the assumption that each segment has a unique signal shape that can be used for identification and extraction.

The segmentation process starts with defining the base signal shapes for each class of objects. Then, the algorithm computes the similarity of the signal shape throughout the time series and separates it into individual segments based on the minimal distance between the signal shapes.

Algorithm:

  1. Define base signal shapes for each class of objects.
  2. Compute the similarity of the signal shape throughout the time series.
  3. Based on the computed similarity values of the signal shape in the entire time series, divide the time series into individual segments. This is done by selecting the minimum distance between the signal shapes for each class of objects and merging all the time points where the similarity value exceeds this distance into one segment.
  4. Apply additional data processing to eliminate noise and distortions in the signal. For example, filters can be used to remove low-frequency or high-frequency noise, and smoothing methods can be used to reduce the impact of random signal fluctuations.

One example of applying this method is the segmentation of speech signals for speech recognition. In this case, the base signal shapes can be defined for different phonemes, and the algorithm can be used to automatically extract each phoneme from the speech stream.

However, the signal shape fitting segmentation method can be sensitive to noise and distortion in the signal, so additional data processing is required to address these issues.

To implement the signal shape fitting segmentation method in Python, you can use the librosa library for audio analysis and matplotlib for visualization. The code is provided below:

import librosa

import numpy as np

import matplotlib.pyplot as plt

 

def shape_fitting_segmentation(audio_path, threshold):

 # Load audio

 signal, sr = librosa.load(audio_path)

 

 # Compute audio features

 features = compute_features(signal, sr)

 

 # Segment audio into similar shape segments

 segments = []

 current_segment = []

 for i, feature in enumerate(features):

 if feature > threshold:

 current_segment.append(i)

 else:

 if current_segment:

 

 segments.append(current_segment)

 current_segment = []

 

 if current_segment:

 segments.append(current_segment)

 

 return segments

 

# Function to compute audio features

def compute_features(signal, sr):

 # For example, you can use librosa to compute spectral features

 spectogram = np.abs(librosa.stft(signal))

 spectogram = librosa.amplitude_to_db(spectogram, ref=np.max)

 return spectrogram

 

# Example usage

audio_path = "proba.wav" # Path to audio signal file

threshold = 0.5 # Threshold value for shape similarity of segments

segments = shape_fitting_segmentation(audio_path, threshold)

 

 

# Plotting audio with segmentation

signal, sr = librosa.load(audio_path)

plt.figure(figsize=(14, 5))

librosa.display.waveplot(signal, sr)

for segment in segments:

 start = segment[0]

 end = segment[-1]

 plt.axvspan(start, end, alpha=0.5, color='red')

 

plt.xlabel('Time (s)')

plt.ylabel('Amplitude')

plt.title('Audio Signal with Segmentation')

plt.show()

 

In this code, the shape_fitting_segmentation function takes the path to an audio file and a threshold value for segment shape similarity. It returns a list of segments, where each segment is represented by the indices of the temporal samples of the signal. Then, using librosa, the audio is loaded and the segments are marked on the signal plot using matplotlib.

 

СПИСОК ЛИТЕРАТУРЫ:

 

RESEARCH OF METHODS OF VOICE SIGNAL SEGMENTATION" [Online]. URL: https://libeldoc.bsuir.by/bitstream/123456789/48084/1/Pasternak_Issledovaniye.pdf (accessed: 27.09.23)

  


Полная версия статьи PDF

Номер журнала Вестник науки №12 (69) том 1

  


Ссылка для цитирования:

Zholud L.I., Shevaldysheva E.Z. IMPLEMENTATION OF THE SEGMENTATION METHOD BY FITTING SIGNAL SHAPE IN PYTHON // Вестник науки №12 (69) том 1. С. 796 - 799. 2023 г. ISSN 2712-8849 // Электронный ресурс: https://www.вестник-науки.рф/article/11303 (дата обращения: 17.05.2024 г.)


Альтернативная ссылка латинскими символами: vestnik-nauki.com/article/11303



Нашли грубую ошибку (плагиат, фальсифицированные данные или иные нарушения научно-издательской этики) ?
- напишите письмо в редакцию журнала: zhurnal@vestnik-nauki.com


Вестник науки СМИ ЭЛ № ФС 77 - 84401 © 2023.    16+




* В выпусках журнала могут упоминаться организации (Meta, Facebook, Instagram) в отношении которых судом принято вступившее в законную силу решение о ликвидации или запрете деятельности по основаниям, предусмотренным Федеральным законом от 25 июля 2002 года № 114-ФЗ 'О противодействии экстремистской деятельности' (далее - Федеральный закон 'О противодействии экстремистской деятельности'), или об организации, включенной в опубликованный единый федеральный список организаций, в том числе иностранных и международных организаций, признанных в соответствии с законодательством Российской Федерации террористическими, без указания на то, что соответствующее общественное объединение или иная организация ликвидированы или их деятельность запрещена.