ref:
就是去memter download source tarball。解開。
然後修改 conf-ld,加上 -static
然後 make 就可以。
因為是在 pi 上 build,所以可以不用cross-build.
2022/4/22
2022/4/21
mosquitto: about topics and config
ref:
大概比較重要的...
系統($SYS) topics 可以直接 subscribe。
在會把 $VAR 認作系統變數的 shell 李,要subcribe 的話。就加上 '\'
wild-card 有兩種: +, #
+ 只是 match 一個階層 (兩個 / 之間)
# 可以 match 多階層。
所以 # 一定要是 topic 的最後。
--- persistant message
一般 message 都是送出後就立刻轉給 subcriber,如果沒有 subscriber 就丟掉。
但是有一種 message 叫 persistant (retained) message。
送出後,mosquitto 會保存在database 中,一旦有人 subcribe,他就會把最新的內容送給他。
同一個 topic,區分為 retained 跟 not retained,如果新 message 不是 retained,不會覆蓋掉 retained message,只是剛好有 subscribe 的會收到 not retained message。
送一個空的 ("") retained message 就可以清掉這個 retained message。
/etc/mosquitto/mosquitto.conf 裡面很簡單,但是有說 example 在 /usr/share/doc/mosquitto/example/mosquitto.conf
大概安裝完,只有對 local (127.0.0.1) 操作。
如果要對外,要加上兩個 options:
系統($SYS) topics 可以直接 subscribe。
在會把 $VAR 認作系統變數的 shell 李,要subcribe 的話。就加上 '\'
wild-card 有兩種: +, #
+ 只是 match 一個階層 (兩個 / 之間)
# 可以 match 多階層。
所以 # 一定要是 topic 的最後。
--- persistant message
一般 message 都是送出後就立刻轉給 subcriber,如果沒有 subscriber 就丟掉。
但是有一種 message 叫 persistant (retained) message。
送出後,mosquitto 會保存在database 中,一旦有人 subcribe,他就會把最新的內容送給他。
同一個 topic,區分為 retained 跟 not retained,如果新 message 不是 retained,不會覆蓋掉 retained message,只是剛好有 subscribe 的會收到 not retained message。
送一個空的 ("") retained message 就可以清掉這個 retained message。
/etc/mosquitto/mosquitto.conf 裡面很簡單,但是有說 example 在 /usr/share/doc/mosquitto/example/mosquitto.conf
大概安裝完,只有對 local (127.0.0.1) 操作。
如果要對外,要加上兩個 options:
listener 1883 0.0.0.0 allow_anonymous true
2022/4/18
memo : fread return value
fread 的 return value 是讀了多少進來。
但是常常會 "一直return 0"。
每次都要再 check 一下 function 宣告:
所以一般都是...這樣:
但是常常會 "一直return 0"。
每次都要再 check 一下 function 宣告:
#include <stdio.h>
size_t fread(void *buffer, size_t size, size_t count, FILE *stream);
那個中間的兩個:size, count 如果相反的話,就會一直 return 0 ,即使有正確讀到資料也一樣。所以一般都是...這樣:
char buf[8];
size_t ret = fread(buf, sizeof(*buf), sizeof(buf)/sizeof(*buf), stdin);
printf("read %zu bytes\n", ret*sizeof(*buf));
2022/4/14
ref:
開機的 message:
Memory: 192820K/1046528K available (5182K kernel code, 490K rwdata, 1464K rodata, 320K init, 225K bss, 26316K reserved, 827392K cma-reserved)是在 mm/page_alloc.c:
void __init mem_init_print_info(const char *str)
{
..
..
pr_info("Memory: %luK/%luK available (%luK kernel code, %luK rwdata, %luK rodata, %luK init, %luK bss, %luK reserved, %luK cma-reserved"
#ifdef CONFIG_HIGHMEM
", %luK highmem"
#endif
"%s%s)\n",
nr_free_pages() << (PAGE_SHIFT - 10),
physpages << (PAGE_SHIFT - 10),
codesize >> 10, datasize >> 10, rosize >> 10,
(init_data_size + init_code_size) >> 10, bss_size >> 10,
(physpages - totalram_pages() - totalcma_pages) << (PAGE_SHIFT - 10),
totalcma_pages << (PAGE_SHIFT - 10),
#ifdef CONFIG_HIGHMEM
totalhigh_pages() << (PAGE_SHIFT - 10),
#endif
str ? ", " : "", str ? str : "");
2022/4/7
build static ps from source
git clone https://gitlab.com/procps-ng/procps.git git chekcout v4.0.0gettext,libncurses-dev,autopoint,libtool
./autogen.sh ./configure --disable-shared LDFLAGS=--static make
2022/3/22
Bookmark : online gdb
onlinegdb
有趣的網站,線上各種語言的ide,但是可以進入 debug mode。
下面會出現 gdb 的 command prompt。
所以可以用來 test 小 code,語法。
也可以用來學習 gdb command
有趣的網站,線上各種語言的ide,但是可以進入 debug mode。
下面會出現 gdb 的 command prompt。
所以可以用來 test 小 code,語法。
也可以用來學習 gdb command
2022/3/21
Test Yolact
紀錄一下步驟,ref:
只是要test 一下 infer。
所以 create 一個 env,並且依照 ref:1 的說明安裝yolact 需要的 packages:
選 yolact_resnet50_54_800000.pth
mkdir weights 並且 copy .pth 進去。
另外,安裝 pytorch,參考 ref:2
所以要save model and weight 要自己改。
yolact.py : torch.save( )
所以 create 一個 env,並且依照 ref:1 的說明安裝yolact 需要的 packages:
conda create --name yolact-3.7.9 python=3.7.9 conda activate yolact-3.7.9 pip install cypthon opencv-python pillow pycocotools matplotlib然後 clone yolact project source:
git clone https://github.com/dbolya/yolact.git然後download trained 好的 weights,在yolact 的 Evaluation 有download link。
選 yolact_resnet50_54_800000.pth
mkdir weights 並且 copy .pth 進去。
另外,安裝 pytorch,參考 ref:2
nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2019 NVIDIA Corporation Built on Wed_Oct_23_19:24:38_PDT_2019 Cuda compilation tools, release 10.2, V10.2.89是 10.2,所以我要用 10.2
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch裝完測試一下:
python >>import torch >> torch.cuda.is_available() TrueOK. test infer:
python eval.py --trained_model=weights/yolact_resnet50_54_800000.pth --image=../test.jpgsource 的 save/load 只有做 weight 的部份。
所以要save model and weight 要自己改。
yolact.py : torch.save( )
訂閱:
文章 (Atom)