How to create or hack the noise reduction model for audio processing python - signal-processing

I have been working on NLP project and Now I need to create Speech-to-text model for that
but my dataset is noisy and I have to create the noise reduction to train my Speech-to-text model
my go is to change some of this items
optimization = {
'amplify': '2.2 dB',
'bass': '9.0 dB',
'treble': '-1.0 dB',
'volume': '1.0 dB',
'speed': '0.98',
'high-pass': {
'frequency': '1000 Hz',
'roll-off': '6dB per octave',
},
'low-pass': {
'frequency': '1000 Hz',
'roll-off': '6dB per octave',
},
'snap-to': 'nearest',
'quality': 'insane-320 kbps',
'variable-speed': 'standard',
'chanel-mode': 'joint-stereo',
'rate': '16000 HZ',
}
so what should I learn first

Related

Automl image prediction problems

I get different results when using a model to get image annotation predictions from web UI and from API. Specifically, using the web UI I actually get predictions, but using the API I get nothing - just empty output.
It's this one that gives nothing using the API: https://cloud.google.com/vision/automl/docs/predict#automl-nl-example-cli
Specifically, the return value is {} - an empty JS object. So, the call goes through just fine, there's just no output.
Any hints as to how to debug the issue?
By default only results with prediction score > 0.5 are returned by the API.
To get all predictions you will need to provide extra argument 'score_threshold' to predict request:
For the REST API:
{
"payload": {
"image": {
"imageBytes": "YOUR_IMAGE_BYTES"
},
"params": { "score_threshold": "0.0" },
}
}
For the python call:
payload = {'image': {'image_bytes': content }, "params": { "score_threshold": "0.0" }}
With this argument all predictions will be returned. The predictions will be ordered by the 'score'.
Hope that helps,
That doesn't work, at least at the moment.
Instead the params need to go at the same level as the payload. E.g.:
{
"payload": {
"image": {
"imageBytes": "YOUR_IMAGE_BYTES"
}
},
"params": { "score_threshold": "0.0" },
}

Firebase retrieve data from a node based on info from another node in Swift

I'm currently working on an app for sports and I'm investigating if/how Firebase can handle the data and relationships I need.
The user logins into the app and goes to a Dashboard, which lists all the Pools he is participating in.
The current data structure for in Firebase is this:
{
Game:
78765: {
teamA: 'New York',
teamB: 'Montreal',
date: '20170601',
etc...
},
76421: {
teamA: 'LA',
teamB: 'Mexico',
date: '20170602',
etc...
}
},
{
Pool:
12345: {
GameID: 78765, <- GameId from above
PoolName: 'MyPool',
Owner: 'LpWgezRkC6EWS0sjXEWxhFl2' <- UserId
etc...
}
},
{
PlayerInPool: {
DUmwewIfzAbfWZN4NjS8mhX82 <- UserId
12345: true <- PoolId from above
LpWgezRkC6EWS0sjXEWxhFl2
12345: true
etc...
}
}
How would I go about pulling the pool information to display on the users Dashboard?
What needs to be displayed in each cell in the UICollectionView is the Pool info (PoolName and PoolOwner) with the Game information like the TeamA and TeamB names along with the Game date.
It is possible to use firebase. I'm fairly new to programming and I caught on in no time. think JSON when you think of your structure and they encourage you to make it as flat as possible (as opposed to lots of nesting). Good Luck! Here is one idea of what your structure might look like.
"GameTitle":{
“PlayerInPool":{
"PoolID":"12345",
“UserID”:“email#address.com”,
“Status”:“Active”
}
“Pool":{
"PoolID":"12345",
“PoolName”:“myPoolName”,
“GameID”:“547324”
}
“Game":{
"PlayerID1":"43623",
“PlayerID2”:“23567”,
“GameID”:“myGame”,
“GameName”:“myGame12345”
}
}

How to use cross-validation method in Tensor-Flow

I'm trying to use cross-validation in Tensor-flow . i write this semi code as my algorithm
Database{
Class1=12000
Class2=20000
}
TrainBatch=
{
Class1=11000
Class2=18000
}
TestBatch=
{
Class1=1000
Class2=2000
}
epoch=5000
while(Epoch>0)
{
K=10
Shufle(TrainBatch);
Devide TrainBatch To 10 Batch For Cross Validation;
for (i=1;i=k;i++)
{
V=Fetch (ValidateBatch[i]);
T=Fetch (TrainBatch-V);
Y=TrainWithTensorflow(T);
Validate(Y,V);
SaveDetail();
}
Epoch--;
}
Final Test(Class1=1000,Class2=2000);
but i don't know how to combine Cross-validation and tensor-flow training parameters in one algorithm.
is method is correct ? or
can anyone correct this method ?

Persisting jqGrid column preferences

I've got a few jqGrids on my ASP.NET MVC 3 application that have a number of columns. I added the following to the column definitions to default some columns to be hidden:
colModel: [
{ name: 'IceCreamID', hidden: true},
{ name: 'RecipeID', hidden: true }
and this works nicely. Those columns aren't visible on my grid.
Then I added this to implement the column chooser:
var grid = $('#icecreamGrid');
grid.jqGrid('navButtonAdd', '#icecreamPager',
{ caption: "Columns", buttonicon: "ui-icon-calculator",
title: "Choose Columns",
onClickButton: function() {
grid.jqGrid('columnChooser');
}
});
Great, brings up the column chooser now. I then added the following to columns I never wanted to show up in the column chooser:
colModel: [
{ name: 'IceCreamID', hidden: true, hidedlg: true},
So I can now hide/show columns just fine. Now, how would you persist this information? DB? As a cookie? Other way? Is there a preferred way to store this sort of information that is really a user preference rather than something related to the data itself?
More Info
Based on Oleg's comment below, I want to provide a little more information.
The point here is that I've got grids with 10-15 columns which could be display based on the user's preference. For a simple example, one of my grid's has the following 9 columns:
IceCream|ShortName|HasNuts|SugarAdded|LimitedRun|PromoItem|Facility|FirstRun|LastRun
Users can hide/show any of these 9 columns based on their personal preferences.
What I want to do is provide a way to persist which columns a particular user wants to see so that s/he doesn't have to re-choose those columns to view each time the page with that grid is shown.
I found you question very interesting. The question about saving the user state of grid are interesting in many cases. There are some interesting answers on such problems which uses cookie (see here for example).
In my opinion saving of the grid state in database on the server or in the localStorage is better way as the usage of cookie. The best way depends on the project's requirements in which you use it. For example the usage of the database storage on the server allows you to implement roaming state of the grid. If you use the localStorage instead of cookies the user preferences will be lost if the user goes to another computer or just if the user will use another web browser on the same computer.
Another problem with the grid state is the maintenance. The information about the columns of the grid you hold typically in the JavaScript or HTML files and not in the database. In the case the both sources can be not synchronous on the changes in the grid. Different scenarios of the update problem could you easy imagine. Nevertheless the advantages of user's preferences so large in some scenarios that the problems with small disadvantages are not so important and can be solved relatively easy.
So I'll spend some time to implement two demos which shows how it can be implemented. I used localStorage in my demos because of many reasons. I mention only two from there:
Cookies is the way which send permanently different information to or from the server which is not really requited. It increases the size of HTTP header and decreases the performance of the web site (see here for example).
Cookies have very hard restrictions. Corresponds to the section 6.3 of rfc2109 or 6.1 of rfc6265: At least 4096 bytes per cookie, at least 50 cookies per domain (20 in rfc2109), at least 3000 cookies total (300 in rfc2109). So the cookies one can't use to save too many information. For example if you would save state of every grid of every your web page you can quickly achieve the limits.
On the other side localStorage are supported by all modern browsers and will be supported in Internet Explorer starting with IE8 (see here). The localStorage will be automatically saved per origins (like a1.example.com, a2.example.com, a3.example.com, etc) and has arbitrary limit of 5 MB per origin (see here). So if you use the space carefully you will far from the any limits.
So I used in my demos the localStorage. I should additionally mention that there are some plugins like jStorage which use localStorage if it's supported by the browser and use another storage, but the same interface for you in case of old browsers like IE6/IE7. In the case you has only less size of storage: 128 kB instead of 5 MB, but it's better as 4K which one has for cookies (see here).
Now about the implementation. I creates two demos: this and it's extended version: this.
In the first demo the following states of grid will be saved and automatically restored on the page reload (F5 in the most web browsers):
which column are hidden
the order of columns
the width of every column
the name of the column by which the grid will be sorted and the sort direction
the current page number
the current filter of the grid and the flag whether the filter are applied. I used multipleSearch: true setting in the grid.
In the same way one can extend (or reduce) the list of options which are the part of the saved grid state.
The most important parts of the code from the demo you will find below:
var $grid = $("#list"),
saveObjectInLocalStorage = function (storageItemName, object) {
if (typeof window.localStorage !== 'undefined') {
window.localStorage.setItem(storageItemName, JSON.stringify(object));
}
},
removeObjectFromLocalStorage = function (storageItemName) {
if (typeof window.localStorage !== 'undefined') {
window.localStorage.removeItem(storageItemName);
}
},
getObjectFromLocalStorage = function (storageItemName) {
if (typeof window.localStorage !== 'undefined') {
return $.parseJSON(window.localStorage.getItem(storageItemName));
}
},
myColumnStateName = 'ColumnChooserAndLocalStorage.colState',
saveColumnState = function (perm) {
var colModel = this.jqGrid('getGridParam', 'colModel'), i, l = colModel.length, colItem, cmName,
postData = this.jqGrid('getGridParam', 'postData'),
columnsState = {
search: this.jqGrid('getGridParam', 'search'),
page: this.jqGrid('getGridParam', 'page'),
sortname: this.jqGrid('getGridParam', 'sortname'),
sortorder: this.jqGrid('getGridParam', 'sortorder'),
permutation: perm,
colStates: {}
},
colStates = columnsState.colStates;
if (typeof (postData.filters) !== 'undefined') {
columnsState.filters = postData.filters;
}
for (i = 0; i < l; i++) {
colItem = colModel[i];
cmName = colItem.name;
if (cmName !== 'rn' && cmName !== 'cb' && cmName !== 'subgrid') {
colStates[cmName] = {
width: colItem.width,
hidden: colItem.hidden
};
}
}
saveObjectInLocalStorage(myColumnStateName, columnsState);
},
myColumnsState,
isColState,
restoreColumnState = function (colModel) {
var colItem, i, l = colModel.length, colStates, cmName,
columnsState = getObjectFromLocalStorage(myColumnStateName);
if (columnsState) {
colStates = columnsState.colStates;
for (i = 0; i < l; i++) {
colItem = colModel[i];
cmName = colItem.name;
if (cmName !== 'rn' && cmName !== 'cb' && cmName !== 'subgrid') {
colModel[i] = $.extend(true, {}, colModel[i], colStates[cmName]);
}
}
}
return columnsState;
},
firstLoad = true;
myColumnsState = restoreColumnState(cm);
isColState = typeof (myColumnsState) !== 'undefined' && myColumnsState !== null;
$grid.jqGrid({
// ... other options
page: isColState ? myColumnsState.page : 1,
search: isColState ? myColumnsState.search : false,
postData: isColState ? { filters: myColumnsState.filters } : {},
sortname: isColState ? myColumnsState.sortname : 'invdate',
sortorder: isColState ? myColumnsState.sortorder : 'desc',
loadComplete: function () {
if (firstLoad) {
firstLoad = false;
if (isColState) {
$(this).jqGrid("remapColumns", myColumnsState.permutation, true);
}
}
saveColumnState.call($(this), this.p.remapColumns);
}
});
$grid.jqGrid('navButtonAdd', '#pager', {
caption: "",
buttonicon: "ui-icon-calculator",
title: "choose columns",
onClickButton: function () {
$(this).jqGrid('columnChooser', {
done: function (perm) {
if (perm) {
this.jqGrid("remapColumns", perm, true);
saveColumnState.call(this, perm);
}
}
});
}
});
$grid.jqGrid('navButtonAdd', '#pager', {
caption: "",
buttonicon: "ui-icon-closethick",
title: "clear saved grid's settings",
onClickButton: function () {
removeObjectFromLocalStorage(myColumnStateName);
}
});
Be carefully to define myColumnStateName (the value `'ColumnChooserAndLocalStorage.colState'``) in the demo) to different values on the different pages.
The second demo is the extension of the first one using the technique from my old answer to your another question. The demo use the searching toolbar and synchronize additionally information between the advanced searching form and the searching toolbar.
UPDATED: The next answer contains extended version of the code included above. It shows how to persist the selected rows (or row) additionally. Another answer shows how to persist the list of expanded nodes of the tree grid and expand the nodes on the relaoding of the page.

Cell triangulation on BlackBerry

Any ideas about how to do cell triangulation for Blackberry and J2ME phones? I know how to get the cell id but I couldn't do triangulation.
If you can do an HTTP Post to an arbitray website, you can use Google's geolocation api.
Simply POST data in the following JSON format to https://www.google.com/loc/json.
See the above link on how to add more information to your json from wifi etc. to greatly increase the accuracy of the result. And pay special attention to the mobile country code, getting it is not obvious.
{
"version": "1.1.0",
"cell_towers": [
{
"cell_id": "42",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code.": 410,
"age": 0,
"signal_strength": -60,
"timing_advance": 5555
},
{
"cell_id": "88",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code": 580,
"age": 0,
"signal_strength": -70,
"timing_advance": 7777
}
]
}
This will return you Google's estimate of the latitude/longitude on your location, along with accuracy and optionally a geocoded address. You can test it quickly e.g. with the Chrome extension called REST Console.
However, it seems that the Blackberry API only provides info on the currently connected cell, not other visible but unregistered cells. In this situation cannot do triangulation, as you (unsuprisingly) need three points to triangulate! However, a less accurate radial estimate of location is still possible.
You can still use the Google API for this, by providing only one tower, or you can use the Ericsson API if you choose. You might want to test with both and compare the accuracy. The Ericcson API is a similar JSON api to Google's, but only expects a single cell as input. A tutorial is available, but it boils down to a JSON request like this:
StringBuffer url = new StringBuffer();
url.append("http://cellid.labs.ericsson.net/json/lookup");
url.append("?cellid=").append(cell.getCellId());
url.append("&mnc=").append(cell.getMnc());
url.append("&mcc=").append(cell.getMcc());
url.append("&lac=").append(cell.getLac());
url.append("&key=").append(API_KEY);
try {
byte[] data = getHttp(url.toString());
if(data!=null) {
JSONObject o = new JSONObject(new String(data));
JSONObject pos = o.getJSONObject("position");
this.longitude = pos.getDouble("longitude");
this.latitude = pos.getDouble("latitude");
this.accuracy = pos.getDouble("accuracy");
this.cellName = pos.optString("name");
}
} catch (IOException e) {
e.printStackTrace();
}

Resources