我正在尝试使用tensorflow进行语音识别.
我输入波形和字作为输出.
波形看起来像这样
[0,0,0,-2,3,-4,-1,7,0,0,0...0,0,0,20,-11,4,0,0,1,...]
Run Code Online (Sandbox Code Playgroud)
单词将是一个数字数组,而每个数字代表一个单词:
[12,4,2,3]
Run Code Online (Sandbox Code Playgroud)
训练之后,我还想找出每个输出标签的输入和输出之间的相关性.
例如,我想知道哪些输入神经元| 样品负责第一个标签(此处为12).
[0,0.01,0.10,0.99,0.77,0.89,0.99,0.79,0.22,0.11,0...0,0,0,0,0,0,0,0,0,...]
Run Code Online (Sandbox Code Playgroud)
输入的原始值将替换为相关,而0表示无相关,1表示总相关.
目标是在单词开始时获取位置.
是否有张量流中的函数来获得这种相关性?
我无法运行它,因为Java仅等待ffmpeg。但是ffmpeg不提供输入-也不提供错误流。它只是运行,但是什么也没做。
插入bash的“ System.out.println(” command:..“)的输出按预期运行正常。因此ffmpeg语法没有问题。
这是代码。
package mypackage;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.imageio.ImageIO;
/**
*
* @author test
*/
public class ffmpeg_hang {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException, InterruptedException {
String INPUT_FILE="/path/to/media";
String FFMPEG_PATH="/path/to/ffmpegFolder/";
for(int i=0;(i+4)<40;i+=4){
String[] ffmpeg_pipe = new String[]{
FFMPEG_PATH + "ffmpeg_4.1.1",
"-ss",(i+""),"-t", "4",
"-i", INPUT_FILE,
"-ac", "1", "-acodec", "pcm_s16le", "-ar", "16000",
"-f","nut","-","|",
FFMPEG_PATH + "ffmpeg_4.1.1",
"-i","-",
"-lavfi", "showspectrumpic=s=128x75:legend=disabled:saturation=0:stop=8000",
"-f","image2pipe","pipe:1"};
System.out.println("command: "+String.join(" ", …
Run Code Online (Sandbox Code Playgroud) 我使用带有mysql的节点js,并希望避免应用程序在连接错误时崩溃.现在我使用这个:
function mysql_handleDisconnect() {
mysql_connection = mysql.createConnection(mysql_config_obj); // Recreate the connection, since
// the old one cannot be reused.
mysql_connection.connect(function(err) { // The server is either down
if(err) { // or restarting (takes a while sometimes).
console.log('error when connecting to db:', err);
mysql_handleDisconnect(); // We introduce a delay before attempting to reconnect,
} // to avoid a hot loop, and to allow our node script to
}); // process asynchronous requests in the meantime.
// If you're also serving http, …
Run Code Online (Sandbox Code Playgroud) 我在JavaFX中使用时间轴对a进行倒计时Label
:
timeline.setCycleCount(6);
timeline.play();
Run Code Online (Sandbox Code Playgroud)
我想在时间轴完成后返回一个值:
return true;
Run Code Online (Sandbox Code Playgroud)
但是,似乎该值会立即返回并且时间轴并行运行。如何等待时间轴完成其倒计时,然后返回值而不阻塞时间轴?
编辑:
为了更加清楚,我已经尝试过:
new Thread(() -> {
timeline.play();
}).start();
while(!finished){ // finished is set to true, when the countdown is <=0
}
return true;
Run Code Online (Sandbox Code Playgroud)
(此解决方案不会更新倒计时。)
编辑2:
这是一个最小,完整和可验证的示例:
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;
public class CountdownTest extends Application {
private Label CountdownLabel;
private int Ctime;
@Override
public void start(Stage primaryStage) {
CountdownLabel=new Label(Ctime+"");
StackPane root = new StackPane();
root.getChildren().add(CountdownLabel);
Scene scene = …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将错误记录到 node.js 中的文件中。我试过温斯顿:
winston= require('winston');
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ level: 'error' }),
new (winston.transports.File)({ filename: 'error.log' })
]
});
Run Code Online (Sandbox Code Playgroud)
我也尝试过console.error:
var log_file_err=
fs.createWriteStream(__dirname + '/error.log', {flags : 'a'});
var err_stdout = process.stderr;
console.error = function(d) { //
log_file_err.write(util.format(d) + '\n');
err_stdout.write(util.format(d) + '\n');
};
Run Code Online (Sandbox Code Playgroud)
为了生成错误,我使用了:
function get_time(date)
{
return date.getHours()+':'+date.getMinutes();
}
console.log(get_time(Date()));//instead of new Date()
Run Code Online (Sandbox Code Playgroud)
我没有收到更多错误(只是 Date() 想要的未定义错误),但 error.log 保持为空。“debug.log”(正常日志记录)我使用覆盖的 console.log 可以正常工作。
我有一些文本包含. A....
The regex is [.][\s][\s][!A-Z]
This 找到包含的字符串。问题是,我不知道如何将其全部替换\n
为除了[A-Z]
有什么区别
ArrayUtils.removeElement
和
ArrayUtils.remove
?