Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件路径同时出现“/”、“\\”,导致找不到文件,请问怎么解决呢 #308

Open
lxyaaaaa opened this issue Dec 8, 2022 · 3 comments

Comments

@lxyaaaaa
Copy link

lxyaaaaa commented Dec 8, 2022

File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\utils\thread.py", line 47, in next
return self.it.next()
File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\speech_model.py", line 68, in _data_generator
wavdata, sample_rate, data_labels = data_loader.get_data(index)
File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\data_loader.py", line 88, in get_data
wav_signal, sample_rate, _, _ = read_wav_data(self.wav_dict[mark])
File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\utils\ops.py", line 36, in read_wav_data
wav = wave.open(filename,"rb") # 打开一个wav格式的声音文件流
File "D:\software\anaconda3\envs\py37\lib\wave.py", line 510, in open
return Wave_read(f)
File "D:\software\anaconda3\envs\py37\lib\wave.py", line 160, in init
f = builtins.open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/data/speech_data/THCHS-30\data_thchs30/train/A8_175.wav

文件路径同时出现“/”、“\”,导致找不到文件,请问怎么解决呢
(文件路径要在哪里修改呢)

@nl8590687
Copy link
Owner

这应该不是混用导致的,windows文件路径的分隔符要写成\\而不是\,因为存在转义,为了避免这个问题可以统一用/做文件路径

@CreepJoye
Copy link

File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\utils\thread.py", line 47, in next return self.it.next() File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\speech_model.py", line 68, in _data_generator wavdata, sample_rate, data_labels = data_loader.get_data(index) File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\data_loader.py", line 88, in get_data wav_signal, sample_rate, _, _ = read_wav_data(self.wav_dict[mark]) File "D:\wenjian\IDEA\python_project\ASRT_SpeechRecognition-master\utils\ops.py", line 36, in read_wav_data wav = wave.open(filename,"rb") # 打开一个wav格式的声音文件流 File "D:\software\anaconda3\envs\py37\lib\wave.py", line 510, in open return Wave_read(f) File "D:\software\anaconda3\envs\py37\lib\wave.py", line 160, in init f = builtins.open(f, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/data/speech_data/THCHS-30\data_thchs30/train/A8_175.wav

文件路径同时出现“/”、“\”,导致找不到文件,请问怎么解决呢 (文件路径要在哪里修改呢)

我用linux也出现了这个问题,请问最后怎么解决的呢

@Yjundayi
Copy link

Yjundayi commented Apr 8, 2024

我的环境是windows,将config把没有的数据集配置删除,然后注意“data_path”这里的斜线

{
"dict_filename": "dict.txt",

"dataset":{
    "train":[
        {
            "name": "thchs30_train",
            "data_list": "datalist/thchs30/train.wav.lst",
            "data_path": "data/speech_data/",
            "label_list": "datalist/thchs30/train.syllable.txt"
        }
    ],

    "dev":[
        {
            "name": "thchs30_dev",
            "data_list": "datalist/thchs30/cv.wav.lst",
            "data_path": "data/speech_data/",
            "label_list": "datalist/thchs30/cv.syllable.txt"
        }
    ],

    "test":[
        {
            "name": "thchs30_test",
            "data_list": "datalist/thchs30/test.wav.lst",
            "data_path": "data/speech_data/",
            "label_list": "datalist/thchs30/test.syllable.txt"
        }
    ]
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants