Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

Google ColabでYoloのDetectをやる

Raspberry pi 4b にlabelIMGを入れてYOLOv3用学習データを作る その2:自前学習データの構築 - Bye Bye Moore
の派生で、そもそもColabで解析できれば手間がないやんと気付き実行したときの記録

実際のところ

! cp runs/train/exp/weights/best.pt /content/drive/MyDrive/ObjectDetection/tstImg

で、認識。
ローカルに保存

!python detect.py --hide-labels --line-thickness 1 --exist-ok --weights /content/drive/MyDrive/ObjectDetection/tstImg/best.pt --source /content/drive/MyDrive/ObjectDetection/tstImg/data_a.png 
! cp runs/detect/exp/data_a.png /content/drive/MyDrive/ObjectDetection/tstImg/result.png

Node-RedのtemplateでURLエスケープを避ける場合

実際のところ

普通の変数展開は"{{ url }}"のように二個括りですが、HTMLエスケープをしない場合

{{{name}}}.

と、三つでくくります

printfでスペース区切りな文字列/変数/実行結果を一つの"%s"に投入したい場合、単純に”で囲えばいいだけ

考えてみりゃ当たり前だったのですが、無駄に時間が掛かったのでメモ

実際のところ

$ printf "%s >>" foo bar
foo >>bar >>

$ printf "%s %s>>" foo bar

$ printf "%s>>" "foo bar"
foo bar>>

実際の例

なんも知らないと力業で%sを並べる羽目になりますが……

$ printf '{"value:": "%s %s" }' `/home/toyota/local/bin/tesseract bindeadbeef.jpg - -l eng `
{"value:": "DEAD BEEF" }

これも単純に囲ってあげるだけで何事もなく済みました

$ printf '{"value:": "%s" }' "`/home/toyota/local/bin/tesseract bindeadbeef.jpg - -l eng `"
{"value:": "DEAD BEEF"}