2025/09/08

Open Street Map Local Server

Switch2OSM

https://switch2osm.org/

因為 Open Street Map 的免費公用特性,所以我們可以複製這些地圖資料到自己的地圖 server,Switch2OSM 是一個推廣 OSM 的專案,我們可以透過這個專案,建置自己的 Map Server

PBF format

.pbf空間數據詳解

PBF 就是 Protocolbuffer Binary Format 這是基於 ProtoBuffer 的一種 binary data format,這是一種比 XML, GeoJSON 等等地圖格式還要精簡的檔案格式。

在 OSM 通常是以 *.osm.pbf 這個 file extension 代表 OSM PBF file

Open Street Map 在 PBF Format - OpenStreetMap Wiki 有說明該檔案格式的定義。

Taiwan OSM

Geofabrik Download Server Taiwan 這個網站,有固定更新從 Open Street Map 下載的 Taiwan 離線地圖,我們可以到這個網站下載 taiwan-latest.osm.pbf

取得 osm PBF 檔案以後,就可以匯入 switch2osm local map server

docker

參考 Using a Docker container – Switch2OSM 的說明,最簡單的方式就是透過 container 建置 switch2osm

以下以 Redhat 系列的 podman 進行測試

匯入 osm.pbf 檔案

podman volume create osm-data

podman run  --name osmtile-import -v /root/download/osm/taiwan-latest.osm.pbf:/data/region.osm.pbf  -v osm-data:/data/database/  overv/openstreetmap-tile-server  import

tile server

podman volume create osm-tiles
# 啟動 tile server
podman run --name osmtile -p 8081:80 -v osm-data:/data/database/ -v osm-tiles:/data/tiles -d overv/openstreetmap-tile-server run

啟動後就可以在 http://localhost:8081/tile/ 看到透過 Leaflet 取得的 OSM 地圖

2025/09/01

WhisperSpeech

WhisperSpeech是一種反轉Whisper技術,實做的TTS系統。

安裝測試

在 Rocky Linux 8 的 Python 3.11 安裝測試

dnf install python3.11
# 在執行測試時,會需要 python.h,故需要安裝 devel 套件
dnf install python3.11-devel

python3 -m venv /root/venv/whisperspeech
source /root/venv/whisperspeech/bin/activate

pip3 install WhisperSpeech
pip3 install webdataset

測試程式

import torch
import torch.nn.functional as F
from whisperspeech.pipeline import Pipeline

pipe = Pipeline(s2a_ref='collabora/whisperspeech:s2a-q4-tiny-en+pl.model', torch_compile=True)
pipe.generate_to_file("output.wav", "Hello from WhisperSpeech.")

以 time 測試執行時間

time python3 test.py
real    0m38.452s
user    2m19.176s
sys    0m1.683s

真實時間大約花了 40s,這邊是用 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 的機器,沒有用到 GPU

這個網站可以聽到 WhisperSpeech 產生的語音結果

WhisperSpeech - New Text-To-Speech Model In Town

References

GitHub - WhisperSpeech/WhisperSpeech: An Open Source text-to-speech system built by inverting Whisper.

whisperspeech 英文TTS的实现_whisper speech-CSDN博客