--- tags: Conference, PyConTW2021 image: https://i.imgur.com/0TqkCd0.png lang: zh-tw --- # PyConTW 2021 https://tw.pycon.org/2021/zh-hant 10/2 and 10/3 hosted online. I bounght Corporate (with PySafe), which is 3,000 NTD. Schedule https://tw.pycon.org/2021/zh-hant/conference/schedule ## 闖關遊戲 Raffle code A: Python. Raffle code B: TW. Raffle code C: reunion() ## Day 1 ### 當大家都會Python時 Time: 09:00 - 09:55 Speaker: 魏澤人 ### [R1] 自問自答:命名實體識別應用於精準醫療服務-以智能理賠為例 Time: 10:05 - 10:30 Speaker: 中信 江侑倫 診斷證明書 非結構化資料 智能理賠 Unstructured Data -> OCR -> NER -> Structured Data -> Database Use Transformer / BERT (Masked word & Sentence relationship) Question answering vs Sequence labeling ![](https://i.imgur.com/rZeA72y.png) Question answering handles multiple labels, but sequence labeling doesn't. ![](https://i.imgur.com/lzTEIxK.png) ![](https://i.imgur.com/SH6n14u.png) ![](https://i.imgur.com/4oHt3tI.png) ### [R1] Python 資料科學應用 — 血液透析之血壓預測模型 Time: 10:40 - 11:25 Speaker: JiunYi Yang 血壓預測模型 利用身高、體重、心律等等超多feature為輸入 - SMOTE addresses imbalanced data - Cross validation - Recursive feature elimination (like feature selection) - Binary confusion matrix - LightGBM is good - LSTM is good - SHAP (SHapley Additive exPlanation) is better than feature importance in visualization ### [R2] DAFunctor: Symbolic translator from NumPy/PyTorch ND-Array operations to C Time: 10:40 - 11:25 Speaker: Buganini Chiu 移植 deep learning model 到各種platform上 Python -> C 車用系統不可使用動態記憶體 - Cython (有用動態) - NumCpp (有用動態) - NumExpr Functor (return a function) vs Function (return a value) Generative function vs Aggregate function Convert Python function to C code with Python - reshape - repeat - etc. 全是技術細節 AST ### [R0] Beyond Units: End-to-End Web UI Testing Time: 11:35 - 12:05 Speaker: Andrew Knight 中文開場 AutomationPanda.com A Pythonist who likes testing. Published a book "The Way to Test Software". #### Misconception > unit testing === all testing (This is wrong!) ![](https://i.imgur.com/qP5FDwk.png) ![](https://i.imgur.com/umCiiYx.png) There is a difference between - testing code (white box test; "unit" or "subcutanuous") and - testing features (black box; "integration" or "end-to-end"). #### Web UI Testing A black box testing of a web app though a browser. Good tests focus on ROI. Pytest with Selenium web driver / Playwright web driver. ```python= @pytest.fixture def browser(): b = selenium.webdriver.Chrome() b.implicitly_wair(10) yield b b.quit() ``` ### [R0] Narrative-focused video games development with Ren'Py, an open source engine Time: 13:05 - 13:35 Speaker: Susan Shu Chang Ren'Py = Ren Ai (恋愛) + Python https://www.renpy.org/ #### About Speaker PyCon US, PyCon Canada, PyCon India, PyCon TW Data scientist in Clearco Established Quill Game Studios. Made a game called "A summar with the Shiba Inu". Sold 10k+ in 6 months. https://store.steampowered.com/app/916030/A_Summer_with_the_Shiba_Inu/ #### Video Games - AAA studios - Indie studios Narrative-driven games 有豐富劇本的遊戲 - Ren'Py - Simple DirectMedia Layer (SDL) - Ren'Py SDL2 fork #### Ren'Py's Features - Transition effects - 3D Camera #### A Summar with the Shiba Inu ![](https://i.imgur.com/Px6K2zY.jpg) ![](https://i.imgur.com/XhBoB9m.jpg) #### Some Ren'Py Games - Doki Doki Literature Club! - Long Live The Queen ### [R1] Using Python with Network Analysis to understand corruption in government procurement Time: 13:05 - 13:35 Speaker: Albert 'bash' Yumol Manila Philippines DataScientist and AI Consultant, Edtech 圖論教學 NetworkX Visualization helps recognize the following situations: - Bid Rigging - Low competition Useful tools: - Bokeh - Heroku - Streamlit ### [R2] 搭上Streamlit特快車遊沐星光程式 Time: 13:40 - 13:55 Speaker: 蘇羿豪 天文資料科學背景 為了降低與PM溝通障礙而使用Streamlit https://streamlit.io/ https://share.streamlit.io/daniellewisdl/streamlit-cheat-sheet/app.py https://streamlit.io/cloud https://streamlit.io/gallery ![](https://i.imgur.com/5LpL3U7.png) Astroquery取得行星資料 Pandas結構化資料 Plotly視覺化資料 SunPy處理太陽觀測資料 ### [R1] Turning Pandas DataFrames to Semantic Knowledge Graph Time: 14:05 - 14:35 Speaker: Cheuk Ting Ho Pandas introduction ### Appier Talk 1: Vector - 可靠高效的Data pipeline實戰 分享與Q&A fluentd -> vector https://github.com/vectordotdev/vector The note is here: https://hackmd.io/@isba-research-methods/rkgkDPSVK ### Appier Talk 2: 關於觸碰touch的二三事 Time: 16:00 - 17:00 Speaker: Sonja Kao / Grace Yeh ![](https://i.imgur.com/oBgxsPn.png) ![](https://i.imgur.com/QOMfD46.jpg) iOS Safari比較特別 #### Magic CSS ##### 長按出現選單 iOS ```css= webkit-touch-callout: default; webkit-touch-callout: none; ``` Android (這個方法影響範圍比較大) ```javascript= window.addEventListener("contextmenu", e => e.preventDefault()); ``` ##### 選取 ```css= user-select: auto; user-select: none; user-select: text; /* 只能選擇文字 */ user-select: all; /* 單擊一次就可以選取 */ ``` ##### 觸摸 ```css= touch-action: auto; touch-action: none; touch-action: pan-x/pan-left/pan-right; touch-action: pan-y/pan-up/pan-down; touch-action: pinch-zoom; touch-action: manipulation; ``` #### Best Libraries https://openbase.com/categories/js/best-javascript-touch-events-libraries #### Debugging - iOS: Safari remote debugging - Charlies for mobile #### 300ms Delay FastClick libaray ```htmlembedded= <meta name="viewpoint" content="width=device-width,user-scalable=no"> ``` ![](https://i.imgur.com/Hju2Vl3.png) ### Appier Talk 3: Performance Test - Locust分享與Q&A Time: 17:00 - 18:00 Speaker: Appier QA Wei Chen - Load test 一定時間內的負載量 - Stress test (spike) 同時處理需求的數量 - Stability test (endurance) 服務不同需求並維持一段時間 #### JMeter vs Locust JMeter為Java-based,適合很單純就是要測performance。 Loust為Python原生package,串接Python開發的應用比較容易。 ![](https://i.imgur.com/T8MvFWD.png) ![](https://i.imgur.com/WONdao0.png) ### Lightning Talk: Tagtoo ## Day 2 ### [R1] Building Features from Audio for Machine Learning Time: 10:00 - 10:30 Speaker: Jyotika Singh VP of Data Science at ICX Media, Inc. #### Audio Signal that vibrates in the audible frequency range. #### Specturm and Cepstrum Audio signal -> Fourier Transform -> Spectrum -> Log magnitude -> Inverse Fourier Transform -> Cepstrum #### Mel Frequency Cepstral Coefficients (MFCC) Spectrum -> Mel Scale Filter Bank -> Log Magnitude -> Discrete Cosine Transform -> MFCC #### Gammatone Frequency Cepstral Coefficients (GFCC) Peaks of GFCC are smoother than MFCC. Spectrum -> Spectrum Gammatone Filter Bank -> Downsample and loudness compression -> Discrete Cosine Transform -> GFCC #### Other Features - Linear Prediction Ceptral Coefficients (LPCC) - Bark Frequency Cepstral Coefficients (BFCC) - Power-Normalized Cepstral Coefficients (PNCC) ![](https://i.imgur.com/Ov7MWkt.jpg) ![](https://i.imgur.com/UtIuKEB.jpg) #### Tools #### Machine Learning 1. Data collection 2. Data cleaning 3. Data transformation ![](https://i.imgur.com/Z6MrCH5.jpg) ### [R1] Supercharging your Jupyter and Machine Learning Workflow with PrimeHub Time: 10:35-11:20 Speaker: Chia-liang Kao (CEO & Co-Founder InfuseAI) Started svk Co-founded g0v.tw Co-founded InfuseAI Help enterprises adopt AI with MLOps 26 FTE Jupyter is available via - pip install jupyterlab - nteract - VSCode - CoLab ![](https://i.imgur.com/atu8YtA.jpg) #### MLOps Challenges - Standardized pipeline (access data, integrate with dev workflow) - Standardized model deployment - Versioning everything ![](https://i.imgur.com/pxi6Z5Z.jpg) ![](https://i.imgur.com/RDqS2IV.jpg) #### PrimeHub https://one.primehub.io ##### Features - Notebooks - Shared Files (S3) ##### Apps - MLFlow: model management - Streamlit: visualization - Label Studio: data labeling (They developed.) ![](https://i.imgur.com/bDqgOwU.jpg) ![](https://i.imgur.com/7GmymZK.jpg) ![](https://i.imgur.com/ZIa2sHD.jpg) ![](https://i.imgur.com/xX2fc8J.jpg) #### Case Study 奇美醫院 急診室流量預測 > "It used to take 5~6 days to communicate, now we can deploy the model within 1 hour after training." - Director of AI Center ### [R2] Let's make your data pipeline robust with Great Expectations! Time: 11:30 - 12:00 Speaker: Keisuke Nishitani (待補聽) ### [R1] 用Python刻一個深度學習圖片重點裁切系統 (Implementation of a deep learning-based saliency detection system by Python) Time: 13:00 - 13:45 Speaker: 何明洋 Dcard intern project. The images user upload do not always fit App layout. #### Deep learning for computer vision - Image-level - Dense task - Sparse task - Time series #### Saliency Detection ##### Related Works - Twitter "Faster Gaze Prediction With Dense Networks and Fisher Pruning" - "Pyramid Feature Attention Network for Saliency Detection" https://github.com/sairajk/PyTorch-Pyramid-Feature-Attention-Network-for-Saliency-Detection http://saliencydetection.net/duts/ Pretrained models (on DUTS dataset, the largest saliency detection benchmark with the explicit training/test evaluation protocol) https://pypi.org/project/face-recognition/ https://github.com/DayBreak-u/chineseocr_lite - Saliency detection - Face recognition - OCR ![](https://i.imgur.com/QpfRRLo.jpg) ![](https://i.imgur.com/qeq2VgY.jpg) ![](https://i.imgur.com/rGyLDyS.jpg) ![](https://i.imgur.com/M6xleih.jpg) ![](https://i.imgur.com/uvj8iWg.jpg) ![](https://i.imgur.com/o5s3kve.jpg) ![](https://i.imgur.com/qf5ZJca.jpg) ![](https://i.imgur.com/4HaCI4G.jpg) ![](https://i.imgur.com/3R2d804.jpg) ![](https://i.imgur.com/tbvuHBc.jpg) ### [R2] 從 Flask 邁向 FastAPI 的心路歷程 - 用房屋估價模型服務體驗急速開發、高效能的快感! Time: 13:00 - 13:45 Speaker: 陳家丞 (待補聽) ### [R3] PEP 634 Structural Pattern Matching 參上,你終究還是要用語言學來做 NLP 齁! Time: 13:00 - 13:45 Speaker: PeterWolf 結構 斷詞 Articut / Loki Abstract Syntax Trees: ast.py ![](https://i.imgur.com/5s8pL4Q.jpg) ![](https://i.imgur.com/J3Owz6x.jpg) ![](https://i.imgur.com/EWOnKVz.jpg) #### PEP 634 Introduced in Python 3.10. `match... case...` https://www.python.org/dev/peps/pep-0634/ https://25349023.github.io/articles/2021-03/py-structural-pattern-matching/ https://25349023.github.io/articles/2021-06/py-structural-pattern-matching-in-depth/ ![](https://i.imgur.com/Va9lJm3.jpg) #### Demo [droidtown](https://www.droidtown.co/zh-tw/) https://api.droidtown.co/ The Zen of Python: Readibility counts! ### [R1] What you need to know about deploying AI model to edge device Time: 13:55 - 14:25 Speaker: 吳啟聖 NTHU AILab Master Degree Mediatek Edge Device #### Edge Computing - Cloud computing (e.g., Macbook Siri) - long latency - Edge device (e.g., iPhone Siri) - requires CPU + NPU #### From Python to Product ![](https://i.imgur.com/mLv38W8.jpg) ![](https://i.imgur.com/S0P2MqU.jpg) ### 想法、展望與現實:回望過去二十年的社群耕耘成果 Looking back on 20 years of community work Speaker: Marc-Andre Lemburg Joining from Dusseldorf, Germany eGenix.com GmbH Python Core Developer #### My Passion for Python OS/2 ![](https://i.imgur.com/ldAUWrt.jpg) He made the datetime module!!! Python Software Foundation (PSF) founded in 2001. First EuroPython conference in 2002 in Charleroi, Belgium. EuroPython Society (EPS) founded in 2004. Today EPS has 600k EUR budget. 心路歷程 對於開發Open Source Software應抱持什麼樣的態度 ![](https://i.imgur.com/3NaVmvJ.jpg) ![](https://i.imgur.com/CndvshQ.jpg) ## Yi-An Day 1 R0 https://www.youtube.com/watch?v=r1d5G27k-Sw R1 https://www.youtube.com/watch?v=vnQHx7GqC_0 R2 https://www.youtube.com/watch?v=01Lab4sdZwg R3 https://www.youtube.com/watch?v=o4g-ZdqWlQU Day 2 R0: https://www.youtube.com/watch?v=Hav0Nfl4H_U R1: https://www.youtube.com/watch?v=rbpbed4KXvE R2: https://www.youtube.com/watch?v=0U_5VIM6CQA R3: https://www.youtube.com/watch?v=4UYR6TGjgfY Day 1 https://tw.pycon.org/2021/zh-hant/conference/talk/210 成功地測試失敗 (Fail tests successfully) Keith Yang vcrpy 錄下第三方 request 的 response https://tw.pycon.org/2021/zh-hant/conference/talk/195 DAFunctor: Symbolic translator from NumPy/PyTorch ND-Array operations to C Buganini https://github.com/buganini/DAFunctor https://tw.pycon.org/2021/zh-hant/conference/talk/214 使用 Pyodide 讓你在瀏覽器中直接運行 Python - 以醫療數位影像 DICOM 視覺化為例 Grimmer Kang https://tw.pycon.org/2021/zh-hant/conference/talk/203 Narrative-focused video games development with Ren'Py, an open source engine Susan Shu Chang https://tw.pycon.org/2021/zh-hant/conference/talk/185 如何使用blender簡單建造金屬原子/2D材料模型 李嘉穎 https://tw.pycon.org/2021/zh-hant/conference/talk/188 WeatherPi,一個用 Raspberry Pi 和 Python 的微型氣象站專案 sosorry dash by plotly LPWAN, LoRa INA219 sensor 計算耗電量 https://tw.pycon.org/2021/zh-hant/conference/tutorial/8 使用 Pytest 進行單元測試 Max Lai 聽一下 plugin 的部分 https://tw.pycon.org/2021/zh-hant/conference/keynotes#Yenny_Cheung 打造下一個時代的 AI 助理 Yenny Cheung Demo RASA: make/train a chatbot using some configs Day 2 https://tw.pycon.org/2021/zh-hant/conference/tutorial/9 Knowledge graph data modelling with TerminusDB Cheuk Ting Ho day1 有講過了 https://tw.pycon.org/2021/zh-hant/conference/talk/216 用Python做太陽能發電監控 Malo 太陽能發電廠的監控 監控發電效率,有獎一些有趣的個案導致發電效率降低,有興趣可以去看 逆變器,日照計,溫度貼片,數位電表 用有線連線方式 Modbus/RTU, Modbus/TCP 跟資料收集器連接,但沒說收集器實際上是什麼。 收集器上跑 python 去收資料然後丟給 web server 有講他們的 web server 架構,但很一般,沒什麼值得講的 https://tw.pycon.org/2021/zh-hant/conference/talk/211 使用 Python 實現可即時互動用的遠端影音傳輸 Milo Chen 講 p2p 影音傳輸 (Amy 的領域?) 有提到內網穿透 (STUN, TURN) 用 aiortc (WebRTC) 傳送影音,看起來蠻簡單的 https://tw.pycon.org/2021/zh-hant/conference/talk/187 Supercharging your Jupyter and Machine Learning Workflow with PrimeHub Chia-liang Kao similar to AML notebook? 主打讓 scientist 可以不用碰到 engineering 的部分,但寫完就可以很容易地上 production。 AWS auto scale + Docker 主要功能 - Jupyter notebook - mlflow - streamlit - label studio (https://github.com/heartexlabs/label-studio) 個人覺得所有用 notebook 的 work 都還有很長遠的路要走,首先就必須解決 version control 的問題, 例如環境設定要怎麼進 git,notebook 在 git 上要怎麼 diff/review。 再來要解決切割 library 的問題,總不可能所有 code 都塞在同一個檔案。 https://tw.pycon.org/2021/zh-hant/conference/talk/218 用Python實作環境偵測及預警系統 Victor Gau 講者好像很有趣,或是說很無聊,一堆 side project。 茄萣濕地保育 (黑面琵鷺會來過冬) 講者覺得那邊道路過度開發,但又沒什麼人要重視,因此做了很多相關推廣,但沒得到什麼重視 後來又覺得政府給的水質監測等等的人力,金錢資源不夠。一季才做一次,風險太大,所以用 rpi + DHT-11 和太陽能板架設監控系統 (一個像小路燈的東西,直接插在地上或水裡)。還有建資料開放平台。 用電信網路或 WIFI,發 data 給 MQTT broker (HiveMQ),local 再從上面拿下資料畫圖 昨天聽完演講之後用 streamlit 寫出來一個新的 real-time dashboard,有 demo 一下 有做影像辨識,想要辨識鳥類,但解析度不夠,頂多只能是不是有鳥停在一個地方太久,是不是死掉了要處理。 rpi 開機啟動的用法好像是錯的 (~/.config/autostart),他用了一個需要登入才會自動啟動的,代表他不知道要關掉自動登入,有可能別人插個螢幕鍵盤上去就可以惡搞了 我一般會用 /etc/rc.local,但 best practice 應該是 systemd ,但他比較複雜 https://tw.pycon.org/2021/zh-hant/conference/talk/207 Let's make your data pipeline robust with Great Expectations! Keisuke Nishitani 我沒看,不過 great expectations 看起來不錯 https://greatexpectations.io/ 驗證資料,視覺化 https://tw.pycon.org/2021/zh-hant/conference/talk/199 Learn from LL(1) to PEG parser the hard way Kir Chou PEG: new grammar proposed in 2002 (Packrat parser) https://en.wikipedia.org/wiki/Parsing_expression_grammar A -> a | ab is different from A -> ab | a in PEG, but the same in CFG https://tw.pycon.org/2021/zh-hant/conference/talk/186 從 Flask 邁向 FastAPI 的心路歷程 - 用房屋估價模型服務體驗急速開發、高效能的快感! 陳家丞 1. 解釋 GIL 的時候用的範例看起來是錯的,根本沒有 multithreading,他感覺不是很懂 GIL 和 threading 2. WSGI vs. ASGI 3. 他舉了他們原本 flask 的範例,但那個範例沒有用 thread pool。他說開 thread overhead 很大,卻沒有解釋為什麼沒有用 thread pool,我猜他根本不知道有這東西。而且他用了 Queue,這個 overhead 應該超大。 3. 他舉得 async 範例不太好,並沒有太大的加速,原因是他根本 CPU bound,而且他 stress test 壓力不夠大。實際上他已經得到 async 這邊 server load 低很多的這個現象了,表示他其實有加速很多。 4. 會變快的原因他也沒有搞清楚,他覺得是因為開 thread 和 join 的 overhead 沒了,因為他的 case 是 CPU bound。實際原因我推測是因為有太多 thread 在同時跑,頻繁的 thread context switch & GIL 導致效率降低,另外 Queue 可能也是個原因。 5. 我覺得 async 這個概念大家一定要了解它的好處,之前 Paul 很強調我們開 multithread 去跑 FST 不合理。雖然我之前都沒有發表意見,但這其實這是優化 web server 的一個很重要的概念,其中 async 也占了蠻重要的角色。這牽扯到,一個 CPU 我們應該開一個 worker 給他還是多個,多個的話就會有 context switch 還有多個 request 同時變慢這種問題。 5. Pydantic to validate request and generate API docs 6. Swagger UI & ReDoc https://tw.pycon.org/2021/zh-hant/conference/talk/208 PEP 634 Structural Pattern Matching 參上,你終究還是要用語言學來做 NLP 齁! PeterWolf 爛透了 1. 前面講一堆無關的,而且一般語言都不是 regular language,還有 regular language 舉例 2. 關鍵的 PEP 634 功能重點根本搞錯,範例也是錯的,CreditCard 後面要加括號才是對的。講者遇到後面多加一個 wildcard case 會噴 error 說這個 case 永遠不會跑到,還胡扯說是因為 memory 的 limitation,而且是事先準備好的。 3. 後面根本就在業配他公司做的 NLU engine,而且那個 engine 看起來很醜 https://tw.pycon.org/2021/zh-hant/conference/talk/206 PyMetheus - A Python-based Monitoring System using Raspberry Pi Ing Wei Tang 講者自幹了一個類似 Prometheus 的東西,因為他在 rpi 上跑失敗。沒聽到什麼有趣的技術細節。 https://tw.pycon.org/2021/zh-hant/conference/keynotes#Marc-Andre_Lemburg 想法、展望與現實:回望過去二十年的社群耕耘成果 Marc-Andre Lemburg 講各種推動社群的時候遇到的問題。例如舉辦活動會遇到的問題,或是帶領團隊的時候遇到的問題。