Blog Archive

Tuesday, June 23, 2020

第五届东方语种识别竞赛(以下简称“OLR”)基线系统及ASV-Subtools开源工具

Source:

https://mp.weixin.qq.com/s?__biz=MzA5MzQzMzE1NQ==&mid=2654444699&idx=1&sn=3e021b03a879a6ab6ff2433c7818de43&chksm=8b9ec0b7bce949a11a28bc155573a23eb48b60a99255a3011f7589801ae4d329c9fd3567d8f8&mpshare=1&scene=1&srcid=&sharer_sharetime=1592945342725&sharer_shareid=aa35f0a5ca293a73fb053895968df0b1#rd


第五届东方语种识别竞赛(以下简称“OLR”)基线系统及ASV-Subtools开源工具免费发布啦!


在今年的竞赛中,为了让参赛者们更好地评估自己的系统,以及为初次参赛的参赛者提供可以快速复现的系统,厦门大学智能语音实验室(XMUSPEECH)提供了基于Kaldi和Pytorch两个开源平台的基线系统:基于Kaldi的i-vector系统和x-vector系统,基于Pytorch的x-vector系统。参赛者们可以通过以下网址进行参考和下载基线系统:

https://github.com/Snowdar/asv-subtools#2-ap-olr-challenge-2020-baseline-recipe-language-identification

 

OLR基线系统可以帮助初次接触语种识别的参赛者快速搭建一套语种识别系统;另外,厦门大学智能语音实验室同时开源了ASV-Subtools工具,ASV-Subtools工具相比于其他开源工具的优势在于其整合了Pytorch的训练和Kaldi的前端后端处理,不仅可用在今年的语种识别竞赛,还可用于声纹识别系统的搭建。

 

ASV-Subtools提供了完整的基于shell脚本的recipe供参赛者快速搭建一套语种识别系统或者复现OLR基线系统。在提供的run.sh这一个脚本中就可以实现基于i-vector和x-vector的语种识别系统搭建,得到符合竞赛要求的输出分数文件。

 

如下图所示,ASV-Subtools工具同时整合了Kaldi工具和Pytorch工具:使用Pytorch来训练模型,其余流程使用Kaldi处理。除了ASV-Subtools中提供的配置选项外,使用者也很容易在Pytorch上补充选项之外的需求,快速自定义神经网络,用于声纹识别模型的训练。

 

关于ASV-Subtools的更多细节可以参考:

https://github.com/Snowdar/asv-subtools

Sunday, June 14, 2020

Eliud Kipchoge – 15 Motivational Quotes About Training and Life

Eliud Kipchoge – 15 Motivational Quotes About Training and Life
“The world is actually full of challenges and we need to challenge ourselves. I took a challenge to run that fast. It consumes a lot of energy especially mentally. But I took myself and accepted to be challenged and I challenged the time.”
“I had a friend in India who told me that – the guys is 50 years now – and he told me he will die before we see a human being run two hours flat. I met him one month ago in New York and I joked ‘You will never die again because you have seen me run two hours.’”
“Self-discipline starts with you. It’s no other person. It starts with you. Start to examine yourself…Self discipline is doing what’s right instead of doing what you feel like doing. That’s the meaning of self-discipline.”
“After accommodating self discipline in your mind, self-discipline can help you to actually get three things. It can save your feelings. Get you back on the course when you try to think otherwise, self discipline can help easily come back and think positively. It helps you do the right thing in the moment for long-term benefits.”
“Don’t make excuses. When you have decided to do something, do it. No excuses. Then you are self-disciplined.”
“Make discipline your lifestyle. Discipline is not a one-time event. Self-discipline is like building your muscle. It’s like going to the gym. You can not go to the gym today and build your muscle. You should get a program and go slowly by slowly. That’s the way to build your muscle and that’s the way you can have discipline.”
“Only the disciplined ones are free in life. If you aren’t disciplined, you are a slave to your moods. You are a slave to your passions. That’s a fact.”
“There is a sign in one of the nicer schools in Canada. It [says] the best time to plant a tree was 25 years ago. That was the best time to plant a tree. The second-best time is today. Plant the tree of self-discipline.”
“In any profession, you should think positively. That’s the driver of your mind. If your mind is really thinking positive then you are on the right track. ‘Pleasure in what you’re doing puts perfection in your work.”
“I am here because of teamwork. I am here because sport is a mutual interest. I am here to talk about my success because I am really about teamwork. Teamwork actually helps a lot.  Remember in sport, what you have is Hero’s Formula. If you are a hero, then you have a formula and that says 100% of myself is nothing compared to one percent of the whole team. And vice versa. 1% percent of the teams is nothing compared to 100% of myself. And that’s the meaning of teamwork.”
“When you bring motivation and discipline (together), then you can be consistent. When you combine it all together, they say if you want to grow, consistency is the key. I’m confident in saying that consistency is key if you want to grow in a new profession. Be it sport. Be it law. Be it all sorts of professions. If you are not consistent, you can not go anywhere. Consistency makes you to grow.”
“Accept change…I know it is not really comfortable to adopt change but change in life of a human being or life of any profession is really important. But change can not be forced.”
“Personally, I believe in what I am doing. To run a big marathon and win, it takes five months. When I am on the starting line, my mind starts to think of what I have been doing for the last five months. I believe in my training. I treat myself as the best one on that line because my mind is telling me that I am the best and I believe in what I am doing in the last five months. I can run free. I can run free and that’s what actually has helped me to be successful.”
“I always tell people that this is a really simple deal: Work hard,” he said. “If you work hard, follow what’s required and set your priorities right, then you can really perform without taking shortcuts. If you’re taking shortcuts, you can’t be free.”
“In the marathon, the first half is just a normal run. At 15 kilometers, 20 kilometers, everybody is still going to be there. Where the marathon starts is after 30 kilometers. That’s where you feel pain everywhere in your body. The muscles are really aching, and only the most prepared and well-organized athlete is going to do well after that. I’ll go with the pace, but after 30 kilometers, I’ll change to my own pace. And if you’re ready to follow me, then we can go together.”

Monday, June 1, 2020

Python cheatsheet

To help C++ background reader, corresponding C++ syntax is also provided whenever necessary

Variables

a = 1       # integer
b = 1.1     # float
c = 1 + 2j  # complex number (a + bi)
d = 'a'     # string
e = True    # boolean (True / False)

Strings

x = "Python"
len(x)
x[0]
x[-1]
x[0:3]

# Formatted strings
name = f"{first} {last}"

# Escape sequences
\” \’ \\ \n

# String methods
x.upper()
x.lower()
x.title()
x.strip()
x.find(“p”)
x.replace(“a”, “b”)
“a” in x

Type Conversion

int(x)  
float(x) 
bool(x) 
string(x)

False Values

0
""
[]
False

Conditional Statements

if x == 1:  
    print(“a”)
elif x == 2:  
    print(“b”)
else:   
    print(“c”)

# Ternary operator 
x = "a" if n > 1 else "b"
# x = n > 1 ? "a" : "b" # C++
# Chaining comparison operators
if 18 <= age < 65:

Loops

for n in range(1, 10): 
    print(n)

while n < 10: 
    print(n)
    n += 1

Functions

def increment(number, by=1):   
    return number + by

# Keyword arguments 
increment(2, by=1) # ok
increment(2, 1)  # ok
increment(2, b=1) # ERR TypeError: increment() got an unexpected keyword argument 'b'
' # Variable number of arguments def multiply(*numbers): for number in numbers: print number multiply(1, 2, 3, 4) # Variable number of keyword arguments def save_user(**user): ... save_user(id=1, name="Mosh")

Lists

# Creating lists
letters = ["a", "b", "c"]     
matrix = [[0, 1], [1, 2]]
zeros = [0] * 5
combined = zeros + letters
numbers = list(range(20))

# Accessing items
letters = ["a", "b", "c", "d"]
letters[0]  # "a"
letters[-1] # "d"

# Slicing lists 
letters[0:3]   # "a", "b", "c"
letters[:3]    # "a", "b", "c"
letters[0:]    # "a", "b", "c", "d"
letters[:]     # "a", "b", "c", "d"
letters[::2]   # "a", "c"
letters[::-1]  # "d", "c", "b", "a" 

# Unpacking 
first, second, *other = letters 

# Looping over lists 
for letter in letters: 
    ... 

for index, letter in enumerate(letters): 
    ... 

# Adding items 
letters.append("e")
letters.insert(0, "-")

# Removing items 
letters.pop()
letters.pop(0)
letters.remove("b")
del letters[0:3]

# Finding items 
if "f" in letters: 
    letters.index("f")

# Sorting lists 
letters.sort()
letters.sort(reverse=True) 
x=[3,1,2]; sorted(x) # output:[1,2,3]; but x is unchanged
# Custom sorting 
items = [
    ("Product1", 10),
    ("Product2", 9),
    ("Product3", 11)
]

items.sort(key=lambda item: item[1])
#sort(items.begin(), items.end(), [](auto& a, auto& b){return a[1] < b[1];}); #C++
# Map and filter 
prices = list(map(lambda item: item[1], items))
expensive_items = list(filter(lambda item: item[1] >= 10, items))

# List comprehensions 
prices = [item[1] for item in items]
expensive_items = [item for item in items if item[1] >= 10]

# Zip function 
list1 = [1, 2, 3]
list2 = [10, 20, 30]
combined = list(zip(list1, list2))    # [(1, 10), (2, 20)]

Tuples

point = (1, 2, 3)
point(0:2)     # (1, 2)
x, y, z = point 
if 10 in point: 
    ... 

# Swapping variables 
x = 10
y = 11
x, y = y, x 

Arrays

from array import array 

numbers = array("i", [1, 2, 3])

Sets

first = {1, 2, 3, 4}
second = {1, 5}

first | second  # {1, 2, 3, 4, 5}
first & second  # {1}
first - second  # {2, 3, 4}
first ^ second  # {2, 3, 4, 5}

if 1 in first: 
    ... 

Dictionaries

point = {"x": 1, "y": 2}
point = dict(x=1, y=2)
point["z"] = 3
if "a" in point: 
    ... 
point.get("a", 0)   # 0
del point["x"]
for key, value in point.items(): 
   ... 

# Dictionary comprehensions 
values = {x: x * 2 for x in range(5)}

Generator Expressions

values = (x * 2 for x in range(10000))
len(values)  # Error
for x in values: 

Unpacking Operator

first = [1, 2, 3]
second = [4, 5, 6]
combined = [*first, "a", *second]

first = {"x": 1}
second = {"y": 2}
combined = {**first, **second}

Exceptions

# Handling Exceptions 
try: 
  …

except (ValueError, ZeroDivisionError):
  …
else: 
  # no exceptions raised
finally:
  # cleanup code 

# Raising exceptions 
if x < 1: 
    
    raise ValueError(“…”)

# The with statement 
with open(“file.txt”) as file: 
   
   … 

Classes

# Creating classes
class Point: 
    def __init__(self, x, y):        
        self.x = x
        self.y = y 

    def draw(self): 
        
        …

# Instance vs class attributes
class Point: 
    default_color = “red”

    def __init__(self, x, y): 
        
        self.x = x

# Instance vs class methods
class Point: 
    def draw(self): 
       
        …
    
    @classmethod 
    def zero(cls): 
        
        return cls(0, 0)


# Magic methods
__str__()

__eq__()
__cmp__()
... 

# Private members 
class Point: 
    def __init__(self, x): 
        
        self.__x = x


# Properties 
class Point: 
    def __init__(self, x): 
        
        self.__x = x

    @property
    def x(self):    
        return self.__x     

    @property.setter:
    def x.setter(self, value): 
        self.__x = value 


# Inheritance
class FileStream(Stream): 
    def open(self): 
       
         super().open()
         … 

# Multiple inheritance 
class FlyingFish(Flyer, Swimmer): 
    … 

# Abstract base classes
from abc import ABC, abstractmethod

class Stream(ABC): 
    @abstractmethod
    def read(self): 
        pass  

# Named tuples 
from collections import namedtuple

Point = namedtuple(“Point”, [“x”, “y”])
point = Point(x=1, y=2)

Reference: