пʼятницю, 24 серпня 2012 р.

GSoC coming to the end



Підходить до завершення літо, а з ним і програма GSoC 2012, у якій мені довелося брати участь. Хотілося б більш детально написати про цей, безумовно цікавий період мого життя, що я й зроблю надалі:).

Як усе починалося


Я вже доволі давно читав про програму GSoC, і в мене було бажання прийняти  у ній участь. Тож, дізнавшись про початок цьогорічної програми, й визначившись, з технологіями, з якими я хотів би працювати (C++/Qt),  я почав ознайомлюватися з FOSS проектами, які використовують ці технології.

Вибір Саймона


Тож, ознайомившись зі списком прийнятих організацій я почав детальніше вивчати ідеї запропоновані організаціями, які декларували використання потрібних технологій. Звичайно ж я, як активний багаторічний користувач KDE, однією з перших відвідав їхню сторінку ідей. Там я знайшов доволі багато цікавих пропозицій. У тому числі й пропозицію про додавання підтримки CMU Sphinx, як backend-a для побудови моделей та розпізнавання у Simon, над якою мені й довелось працювати:). Ознайомившись з доволі великим списком проектів, я все-таки вирішив повернутися до проекту "Simon SPHINX Support". Це рішення спиралося, певно, на те, що Simon зацікавив мене як проект в цілому, і мені було цікаво прийняти участь у його розвитку.


Подання заявки на участь


Отже, обравши проект, у якому я хочу прийняти участь я почав вивчати матеріали необхідні для роботи над ним.
На даному етапі я  припустився помилки, від якої хочу застерегти інших: помилка була у тому, що я дуже  пізно зв'язався зі своїм майбутнім ментором.
Порада наступникам: контактуйте зі спільнотою, у житті якої ви плануєте прийняти участь, заздалегідь. Це допоможе вам та спільноті (а зокрема і вашому ментору) дізнатися один-одного краще і, певно, підвищить ваші шанси бути обраним на участь у програмі. Не потрібно до останнього правити/покращувати свою заявку на участь наодинці (як це робив я=/), краще зробити це зі спільнотою.
Вивчивши ситуацію, наскільки мені дозволяв мій надзвичайно щільний графік, я почав писати свою заявку. Протягом наступного періоду часу, до крайнього терміну подачі заявок, я постійно модифікував та намагався покращити свою заявку. Намагався отримати відгуки на неї від своїх друзів і колег (але як я зазначав вище - краще це робити у взаємодії зі спільнотою).
І, у день коли був крайній термін подачі заявок, я відправив свою на google-melange.com (як мені пояснили пізніше, подача заявки у останній день - це погана практика, але, на щастя, це не вплинуло на рішення про прийняття мене до участі у програмі).
Трохи пізніше зі мною зв'язався мій ментор. Перший наш контакт був чимось, на кшталт неформальної співбесіди ціллю якої було з’ясування мого технічного рівню (чи достатній він для участі у проекті). Судячи з усього я цю співбесіду пройшов :D.
Після цього був період очікування результатів відносно наданих заявок.
Але ось період турбот і невизначеності минув і я дізнався що я пройшов:). (Цікавий факт: за декілька днів до оголошення офіційних результатів на пошту надійшло так зване неофіційне підтвердження від Google - пустий лист із заголовком "Вітаємо").

Робота над проектом


Community Bonding Period


Ця весна була надзвичайно завантаженим періодом мого життя: 
чергові екзамени в університеті, які цього року випали на кінець весни;
курси по Java від SoftServe, які давали дуже велике навантаження, перевищуюче  університетське десь удвічі.  І ось я ще приймаю участь у GSoC... Складно було, дуже не вистачало часу. Тож, ми з моїм ментором вирішили, що протягом цього періоду я буду займатися ознайомленням із Simon та першим знайомством зі Sphinx. Таким чином, цей період пройшов під знаком ознайомлення зі сферою Speech recognition ПЗ взагалі.

Coding period: first part


Як не дивно, але усі проблеми з часом які були під час минулого періоду залишились у силі й на початок цього :D. Тож перші два тижні (поки в мене завершувалися екзамени в університеті) виділяти час для роботи над проектом було надзвичайно важко. По їх завершенню стало легше, але приділяти увесь час GSoC я знов не міг, бо почалася робота над випускним проектом на курсах по Java і навантаженням там, зросло ще більше. У цей період я почав роботу з ознайомлення з кодом потрібних модулів Simon. Також я почав працювати над реалізацією їх версії, яка використовувала SPHINX у якості backend-у. Паралельно з цим я проводив рефакторинг деяких існуючих модулів, пов’язаних з моєю роботою. Тож за певний період часу у мене був готовий модуль адаптера даних для створення моделі SPHINX, та модуль управління створенням моделі. 
Й тут нам на курсах перенесли терміни здачі проекту на два тижні раніше. Це дуже погану вкладалося у мої розрахунки часу.
Мені довелося повністю присвятити себе роботі над випускним проектом, й два тижні я майже не займався розробкою GSoC проекту. 
Настав час здачі випускного проекту на курсах.. Хвилювання, презентація, питання. Іі.. Успіх! Захист пройшов вдало. Отже, день на відпочинок і посилена праця над Simon!





Ми з ментором заздалегідь обговорили цей період і дійшли до того - що головне до midterm evaluation, зробити певний функціонал. Я вірив що мені вдасться це зробити. На щастя, у підсумку так і вийшло:) 
Отже, я переважно зробив до midterm-у, функціонал створення Sphinx моделей. Та першу версію модуля розпізнавання. Й, хоча, багато помилок ще належало виправити й багато функціоналу додати - це був великий крок вперед). Тут можна знайти приблизний перелік того що було зроблено і належало зробити на той момент.

Також під час цього періоду ми почали тісніше спілкуватися з моїм ментором +Peter Grasch. Зараз хотілося б подякувати йому. Працювати з ним  - саме задоволення він у найкоротші терміни, дуже детально відповідав на усі питання, які виникали у мене під час роботи над проектом. Його зауваження до мого коду завжди були конструктивні й обґрунтовані:). Ну і взагалі з ним просто приємно спілкуватися й працювати.
Лише у парі моментів ми не зійшлись з ним у поглядах: 
  1. Використання "розумних покажчиків". Я надаю перевагу використанню розумних покажчиків, замість примітивних там, де на це є змога. Бо це дає змогу полегшити керування пам'яттю і уникнути багатьох не очевидних проблем. Й майже не вносять додаткових витрат продуктивності (та й невелика її втрата у контексті роботи з покажчиками у Simon, на мою думку не грає ролі). На думку Peter ці витрати не обов'язкові і використання "розумних покажчиків" - надлишковість;
  2. Я почав по-трохи ознайомлюватися зі стандартом C++11 і використовувати його елементи у проекті. Але Peter зазначив, що непогано було б мати можливість побудувати проект стабільні версії Debian та Slackware. А в них у поставці, доволі старий gcc, який не має реалізації навіть базових речей з C++11. Втім скорий вихід Debian 7.0 та Slackware 14 повинні виправити це прикре непорозуміння:))

Coding period: second part


Успішно пройшовши midterm evaluation, можна було зітхнути з полегшенням і перейти на більш помірний режим роботи. Бо вже нічого не відволікало від концентрування зусиль на роботі над Simon. 
Отже, протягом цього періоду я стабілізував роботу модуля створення Sphinx моделей та модуля розпізнавання на основі цих моделей, також реалізував модуль тестування моделей на якість розпізнавання. 
Були тут складні моменти. Дуже багато часу я витратив на розуміння того, чому створювані, за допомогою мого модуля, моделі були низької якості. Вирішення цієї проблеми потребувало більш глибокого ознайомлення зі Sphinx.
З цим мені допоміг +Nickolay Shmyrev - найактивніший розробник CMU Sphinx на даний момент, та, як не дивно, документація :D.
У результаті, на даний момент, є повністю функціональна версія Simon, яка вміє працювати з двома backend-aми розпізнавання (є можливість вибору під час компіляції та під час виконання). Яка зараз проходить тестування. Сподіваюся,  незабаром мої напрацювання будуть включені до основної гілки розробки Simon:).

Досвід


Хотілося б трохи сказати про досвід, набутий під час участі у програмі. Він був різним і стосується не тільки програмування і технологій. Новим для мене був досвід віддаленої розробки і роботи з дому. Вельми цікавий досвід, який дає змогу зробити деякі висновки на майбутнє. По перше, час від часу виникали проблеми з мотивацією, але це вирішується роботою над собою. Друга, набагато більша проблема - несприйняття моїм домашнім оточенням того, що я працю і що постійно відволікати мене - це реально погана ідея. Тож, певно, надалі треба або організовувати кабінет, або вибиратися працювати у якісь затишні кафе або ко-воркінг центри.
Звичайно ж, це досвід роботи з технологіями Qt та KDE та з мовою програмування C++. Враження загалом позитивні. Думаю й надалі працювати десь у даному напрямку (хоча мені було б цікаво і я, загалом, планую глянути у сторону мови програмування D, та чого не будь з функціонального програмування).
Також це досвід співпраці з спільнотою відкритих проектів. Це насправді круто, коли ти можеш звернутися до розробника програми або модуля, які тебе цікавлять і отримати розгорнуту відповідь і корисні поради. (Хоча є деякі питання, відносно використовуваних технічних засобів для зв'язку: мені більше імпонують Jabber конференції, замість IRC, та щось на кшталт google groups або форумів замість списків e-mail розсилок.)
Ще це був досвід постійного спілкування англійською мовою з ментором та спільнотою взагалі. Ну що я тут можу сказати.. Треба покращувати свої знання у цій сфері. Хоча, безумовно, за рахунок постійної практики, мої знання значно виросли відносно початку літа.

Результати роботи


У результаті роботи протягом літа у Simon була додана повнофункціональна підтримка CMU Sphinx у якості backend-у (як і очікувалося:)). Тобто тепер можна створювати власні акустичні моделі, та проводити розпізнавання виключно за допомогою Sphinx. Тож тепер Simon не залежить від HTK і може вільно розповсюджуватися (сподіваюся на скоре включення Simon до основних репозиторіїв усіх популярних дистриб’ютивів). 
Peter просив проілюструвати результати але це складно у моєму випадку, бо майже уся моя робота зв'язана з backend-ом. Тож додаю знімки sam (утиліта створення та тестування моделей, для експертів) та ksimond (управління демоном Simon), на яких видна реалізація можливості вибору backend-у.
KSimond

Sam
Отже, увесь декларований у заявці функціонал реалізовано. І це прекрасно :D.

Тестування


Задля стабілізації і швидшого включення моїх напрацювань до головної гілки розробки Simon непогано було б провести тестування якнайбільшою кількістю людей. Тож запрошую усіх бажаючих до тестування.  Що для цього потрібно зробити:
  1. Встановити залежності:
    • kdelibs;
    • sphinxbase-svn;
    • pocketsphinx-svn;
    • sphinxtrain-svn (ви можете отримати *svn версії інструментів sphinx тут);
    • qwt (>=6.0);
    • hicolor-icon-theme;
  2. Зібрати звідси проект (потрібно збирати гілку SPHINX). 
  3. Завантажити декілька сценаріїв на ваш смак. Натренувати модель для них. Користуватися Simon:)
  4. Розповісти мені про проблеми/вади які ви помітили під час збірки або використання проекту. 
Також усі бажаючи запрошуються до перегляду коду та написання відгуків по ньому. 

Ідеї щодо подальшого розвитку Simon


  1. Глибше вивчивши Sphinx, зробити можливим адаптивне змінення налаштувань створення моделі, відносно вхідних даних. Це повинно покращити якість створюваних моделей;
  2. Також мені ввижається цікавим проект створення мобільного клієнту до simon (з можливістю віддаленого та локального голосового керування);
  3. Ще дуже цікавим є проект з автоматичної побудови сценаріїв для програм, на основі даних, які надаються програмою за допомогою протоколу AT-SPI.

Мої подальші плани


Звичайно ж я буду підтримувати і покращувати код Sphinx backend-у для Simon. 
Що ж до подальших "великих" задач то це я планую оговорити зі спільнотою. Можливо займуся реалізацією однієї з вищеназваних ідей, можливо ми знайдемо ідеї які здадуться мені більш цікавими для реалізації у даний момент.
Ще, як варіант, займуся додаванням повноцінної підтримки CUE для Amarok, бо це, певно, єдине що утримує мене (якщо чесно - не тільки мене, а й багато інших людей) від користування їм. А його розробники вже дуже довго ігнорують це. Тож потрібно виправляти ситуацію :D.
І як я зазначав вище - планую продовжити вивчати технології Qt/KDE, та планую глянути у сторону мови програмування D, та чого не будь з функціонального програмування. :)

---
English version
---





Summer fits for completion, and GSoC 2012 program, in which I had participated, with it. I would like to write in more detail about this, certainly, interesting period of my life:).

Begining



I have read about the GSoC program rather long time ago, and I had a desire to take part in it. So, after learning about the beginning of this year's program, and having determined, with technology, with which I would like to work (C++/ Qt), I began to get acquainted with FOSS projects that use these technologies.


Choosing Simon


So, after getting acquainted with list of accepted organizations, I began to study in more detail the ideas proposed by organizations that declared the use of required technology. Of course, as longterm active user of KDE, i've visited their ideas page, one of the first. There I found quite a lot of interesting offers. Including a proposal to add support for CMU Sphinx, as a backend-a to build models and recognition in Simon, with which I've started to work :). After reading a rather extensive list of projects, I have decided to return to the project "Simon SPHINX Support". This decision was based, perhaps, on that the Simon interested me as project in general, and I was interested to take part in its development.

Creating of proposal

Thus, after selecting a project in which I want to participate I started learning materials needed to work on it.
At this stage I made ​​a mistake from which I want to warn others: the error was that I was very late joined in touch with my future mentor.
Advice for successors: contact in advance with the community, in which's life you plan to participate. This will help you and the community (including your mentor) to know each other better and probably will increase your chances of being selected to participate in the program. You don't have to edit/improve your proposal alone, to the last (as I did = /), it is better to do it with the community.
After examining the situation, as far as my extremely busy schedule allowed it, I started writing my proposal. During the next period of time before the deadline for applications, I constantly modified and tried to improve my proposal. Tried to get feedback on it from friends and colleagues (but as I said above - it is better to do it in conjunction with the community).
And on the day when was the deadline for submissions, I sent my proposal to google-melange.com (as community explained to me later, applying on the last day - is bad practice, but fortunately it did not affect the decision to adopt me into participation in the program).
Later my mentor has contacted with me. Our first contact was something like an informal interview whose purpose was to clarify my technical level (whether it is sufficient to participate in the project). Apparently I passed this interview :D.
After this was waiting period relatively outcomes of applications.
But worries and uncertainty period has passed and I learned that I passed :). (Interesting fact: a few days before the official results i've recived the so-called informal confirmation from Google - a blank email with the title "Congratulations").

Working on the project


Community Bonding Period



This spring has been extremely busy period in my life:
exams at the university, which this year fell in late spring;
courses on Java from SoftServe, who gave a very large load, exceeding university's somewhere twice. And I take part in GSoC ... It was difficult, it wasn't enough time. So we with my mentor decided that during this period I'll getting acquaintance with Simon and first acquaintance with the Sphinx. Thus, this period was marked by acquaintance with the scope of Speech recognition software in general.


Coding period: first part


Oddly enough, but all the problems with time have been during the past period and remained in force at the beginning of this: D. So the first two weeks (until I ended up exams at university) it was extremely difficult to find time to work on the project. After their completion - easier, but i couldn't give all time to GSoC again, because i began working on the final project at the courses on Java and loading there, grew even more. During this period I worked with familiarization with the code of required modules of Simon. I also started working on the implementation of their version, which used SPHINX as a backend. Parallel to this I spent refactoring of some existing modules related to my work. So over some time I had ready module data-adapter to create SPHINX models, and module of model-creation management.



Suddenly course project deadlines was moved two weeks earlier. This is a very poor fit in my timings.
I had to devote myself to work on graduation project, and two weeks I almost never engaged in the development of GSoC project.
Time for passing courses final project had come .. Excitement, presentation, questions. And .. Success! Presentation went well. So, day to rest and intensive work on Simon!

We previously discussed with mentor about this period and come to that: the main thing to midterm evaluation - to make certain functionality. I believed that I could do it. Fortunately, in the end, i did it:)
So, I mainly made ​​to midterm, functionality of creating  Sphinx models. And first version of recognition module. And, although many bugs had yet to be fixed and many functionality still had to be added - it was a big step forward). Here you can find a sample list of what was done and had to do at that time.

Also during this period, we started to communicate with my mentor +Peter Grasch more closely. Now I would like to thank to him. Work with him - really cool thing. He answered all the questions that arose in me while working on the project, as soon as possible, and very detailed . His remarks on my code has always been constructive and reasonable :). Well, in general it's just nice to communicate and work with him.
Only in couple things we did not agreed with him in the views:
  1. Using "smart pointers." I prefer to use smart pointers instead of primitive where this is a possible. Because it allows you to easily manage memory and avoid many of the problems are not obvious. And they almost don't provide additional performance cost (and a small performance loss in the context of work with pointers to Simon, in my opinion does not matter). According to Peter, these costs are not mandatory and the use of "smart pointers" - redundancy;
  2. I started in a little familiarized with the standard C++11 and use its elements in the project. But Peter said that it would be nice to be able to build the project in stable version of Debian and Slackware. And in it's supply, rather old gcc, which has no implementing of even basic things with C++11.  But coming out Debian 7.0 and Slackware 14 should fix this annoying misunderstanding ;)).

Coding period: second part



Successfully passing the midterm evaluation, i could breathe a sigh of relief and move on to working on a more moderate mode. Because nothing distracted from concentrating efforts on working on Simon.
So during this period I stabilized module of creating Sphinx models and recognition module based on these models, was implemented models testing module for recognition quality. There were difficult moments. A lot of time I spent on understanding why created by my module, models were of poor quality. Solving this problem required a more thorough acquaintance with the Sphinx.
There are two factors, helped me to solve this problem   +Nickolay Shmyrev - the most active developer CMU Sphinx at the moment, and, oddly enough, the documentation: D.
As a result, at the moment, we have a fully functional version of Simon, which can work with two recognition backends (you can choose it at compile time and at runtime). This version is now undergoing testing. Hopefully soon my developments will be included in the main development branch of Simon :).

Experience


I would like to say a little about the experience gained during participation in the program. It was different and is not just experience in programming and technologies. New to me was the experience of remote development and experience of working from home. A very interesting experience that lets me draw some conclusions for the future. Firstly, from time to time there have been problems with motivation, but it can be solved by self-improvement. The second, much larger problem - aversion by my relatives that I'm working and constantly distract me - it is really a bad idea. So probably in further time, i need to organize office, or chosen to work in some cozy cafe or co-working centers.
Of course, this is experience of working with Qt and KDE technology and programming language C++ . Impressions generally positive. I think further work somewhere in this direction (although I would be interested and I generally plan to look into the side of the programming language D, and something about the functional programming).
Also it was experience of with working with community of open source projects. It's really cool when you can contact the developer of the application or module that you are interested in and get a detailed response and helpful advice. (Although there are some issues regarding technical means used for communication: me more impressed of Jabber conference instead of IRC, and something like google groups or forums instead of mailing lists).
Also it was the experience of direct communication in English with my mentor and the community in general. Well I can say here .. It is necessary to improve my knowledges in this area. Although, of course, due constant practice, my knowledge increased relative to early summer.

The end result


As a result of work over the summer in Simon has been added full-featured support for CMU Sphinx as a backend (as expected :)). So now you can create your own acoustic model and conduct recognition solely by using Sphinx. And as a result now Simon is independent of HTK and may be freely distributed (hopefully swift inclusion of Simon to the main repositories of all popular distributions).
Peter asked to illustrate the results but it is difficult in my case, because almost all my work connected with backend. So i've add pictures of sam (utility to create and test models for experts) and ksimond (Simon daemon management), where is visible implementation of choosing backends.
KSimond

Sam
So, all declared in the proposal functionality is implemented. And that's great: D.

Testing


For stabilization and rapid accepting of my developments to main development branch of Simon would be nice to test it. So I invite everyone to test. What you need to do:

  1. Install dependencies:
    • kdelibs;
    • sphinxbase-svn;
    • pocketsphinx-svn;
    • sphinxtrain-svn (you can get *svn versions of sphinx tools here);
    • qwt (>=6.0);
    • hicolor-icon-theme;
  2. Build project from here (you need to build SPHINX branch).
  3. Download several scenarios to your taste. Train model for them. Use Simon :)
  4. Tell me about problems/bugs you find during building or using project.

Ideas for further development of Simon


  1. After deeper studying Sphinx, add capability of adaptive change  Sphinx settings of model creation with respect to the input data. This should improve the quality of generated models;
  2. Also, I imagine interesting project of creating a mobile client to simon (with the possibility of remote and local voice control);
  3. Another interesting project - automatic construction of scenarios for applications based on data provided by the program with AT-SPI protocol.

My future plans


Of course I will support and improve the code of Sphinx backend for Simon.
As for the future "big" projects, I plan to decide it in collaboration with the community. Maybe will implement one of the above ideas, or we can find ideas that seem to me more interesting for implementation at the moment.
Also, as an option, will take care of adding full support of CUE for Amarok, because it is probably the only thing that holds me (to be honest - not only me, but many other people) from using it. But its developers have ignored this feature for too long. So need correct the situation :D.
And as I said above - I plan to continue to explore Qt/KDE technologies, and I look into the side of the programming language D, and something about the functional programming. :)

//Sorry for my rough English

Немає коментарів:

Дописати коментар