2019年10月19日土曜日

学習フェイズ

E-proさんから頂いたサーモグラフィーデータで学習を始めています。
動画から画像を取り出したり、その動画にアノテーションの為の座標とラベルを作るソフトのインストールと学習をスタートするまでの作業で一週間掛かりました。
と言っても日常の業務の合間に少し進めてはストップの繰り返しで歳のせいか途中までの作業を思い出すのも一苦労です。

さて、データを切り出してアノテーションしましたがデータ自体が100ちょっとと学習には少なすぎますがその後の手順の確認に作業を進めて学習をスタートしました。

AlexeyAB さんのDarknetの場合はhttps://github.com/AlexeyAB/darknetが全てと言う事でその指示にしたがってパラメータを入力しました。
1: 45.906712, 45.906712 avg loss, 0.000000 rate, 1460.403615 seconds, 64 images
Loaded: 0.000022 seconds
Region Avg IOU: 0.090963, Class: 0.332260, Obj: 0.500453, No Obj: 0.500137, Avg Recall: 0.023810,  count: 42
Region Avg IOU: 0.063928, Class: 0.332210, Obj: 0.500530, No Obj: 0.500144, Avg Recall: 0.000000,  count: 29
Region Avg IOU: 0.181828, Class: 0.332264, Obj: 0.500599, No Obj: 0.500149, Avg Recall: 0.171429,  count: 70
Region Avg IOU: 0.062633, Class: 0.332089, Obj: 0.500546, No Obj: 0.500141, Avg Recall: 0.000000,  count: 46
Region Avg IOU: 0.109374, Class: 0.332049, Obj: 0.500692, No Obj: 0.500140, Avg Recall: 0.038462,  count: 26
Region Avg IOU: 0.147027, Class: 0.332460, Obj: 0.500515, No Obj: 0.500137, Avg Recall: 0.081967,  count: 61
Region Avg IOU: 0.115006, Class: 0.332235, Obj: 0.500552, No Obj: 0.500143, Avg Recall: 0.035714,  count: 28
Region Avg IOU: 0.357765, Class: 0.333455, Obj: 0.500809, No Obj: 0.500143, Avg Recall: 0.108108,  count: 37


アベレージロスが0.000000と出ています。間違えてました。0.000000 rateって何だろう?
作者によれば、
Note: If during training you see nan values for avg (loss) field - then training goes wrong, but if nan is in some other lines - then training goes well.
nan=0なので学習に失敗しています。

原因は今の時点ではわかりません。アノテーションの作業自体にエラーは出ていないのでデータの量と質に問題があるのかも?
今日はたまたま社外の方からAIの外注は高額な理由を聞かれましたが、この試行錯誤の作業をシステムのエラーかデータの不備かの判断をこの最新を理解するエンジニアに依頼すれば高額にならざるおえないと説明しました。

もちろん既知の技術で問題を解決する作業が簡単と言うわけではなくディープラーニング自体の情報が少なく手探りで進めるしかないのが現状です。ただその向こうには他社に真似の出来ない結果が待っていると言う事です。

出来るだけ他の作業を止めてこの作業に集中しなければいけないようです。

11月26日すべて復旧して再開。
Murouのファイルのラベルを確認
次にlabelimg/data の中にあるpredefined_class.txtを修正
labelimgフォルダの中でプログラムを実行します。
 python3 labelimg.py
darknet/data の中に先ほど作ったjpgとtxtの入ったごちゃ混ぜデータをディレクトリごと移動またはコピー。
 その中にprocess.pyの名称で、以下の内容のファイルを作成ディレクトリ要注意
path_data = 'data/Murou/obj/'
 一応 darknet/ 内に必要ファイルをダウンロードします。このファイルは学習を収束させるために必要なファイルだそうです。  
  YOLO V3.0の場合は
    darknet53.conv.74がダウンロードされます。
 darknet/cfgの中にobj.namesファイルを作成
  obj.names :先ほどのpredefined_class.txtと内容が同じファイル。
   クラス名を改行しながら書きます。今回はHotspot、Panel-Err、String-Err


obj.data    :必要ファイルのリンクを書き込んだファイル。以下のような感じ。
      class   必ず指定。今回の場合3
      train ディレクトリとファイル名を指定 先ほどのtrain.txt
      valid ディレクトリとファイル名を指定 先ほどのtest.txt
      names   クラスファイルの場所とファイル名 obj.names

      backup  学習済みデータの保存先 このままでOK
classes= 3
train  = data/Murou/train.txt
valid  = data/Murou/test.txt
names = cfg/obj.names
backup = backup/
cfgファイルの設定
Create file yolo-obj.cfg with the same content as in yolov3.cfg (or copy yolov3.cfg to yolo-obj.cfg) and:
cfgファイルは新たに作らないと下記デモで同じcfgファイルを使わうので。。。
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights

change line batch to batch=64
change line subdivisions to subdivisions=16
一般的には416x416。精度を上げるには608x608または832x832とする。ただしyolov3の場合608x608で学習させると、私の環境ではメモリーオーバーで止まる。今回618x618の場合は subdivisions=16 とした。
20行目の max_bachesを30000くらいにする
22行目 steps=4000,4500 くらいにする
603,610,689,696,776,783行に書いてある
filters=255
classes=80
の所をクラスが3なら
filters=24
classes=3
に変更します filtersは (クラス数+5)X3  の数値です
いよいよ学習

./darknet detector train cfg/obj.data cfg/yolo-obj.cfg darknet53.conv.74 -map




コマンド間違って8:20頃止めてしまいました。
Ctrl+cでコピーコマンドでログを取ろうとしましたがCtrl+cはquit(停止)と同じでしたね(笑)

 (next mAP calculation at 14700 iterations) 
 Last accuracy mAP@0.5 = 99.35 %, best = 99.43 % 
 14681: 0.225036, 0.257150 avg loss, 0.000010 rate, 6.993637 seconds, 939584 images
Loaded: 0.000019 seconds
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.912137, GIOU: 0.910393), Class: 0.999881, Obj: 0.983405, No Obj: 0.000766, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.830349, GIOU: 0.826423), Class: 0.995696, Obj: 0.897695, No Obj: 0.000465, .5R: 1.000000, .75R: 1.000000, count: 5
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000005, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000002, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.880829, GIOU: 0.880195), Class: 0.999061, Obj: 0.854198, No Obj: 0.000727, .5R: 1.000000, .75R: 1.000000, count: 7
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.800322, GIOU: 0.795880), Class: 0.998760, Obj: 0.395001, No Obj: 0.000165, .5R: 1.000000, .75R: 0.714286, count: 7
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.761692, GIOU: 0.743397), Class: 0.992795, Obj: 0.088460, No Obj: 0.000442, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.892330, GIOU: 0.891681), Class: 0.999716, Obj: 0.970838, No Obj: 0.001251, .5R: 1.000000, .75R: 1.000000, count: 10
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.781882, GIOU: 0.780087), Class: 0.949109, Obj: 0.497191, No Obj: 0.000057, .5R: 1.000000, .75R: 0.333333, count: 3
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.857719, GIOU: 0.857054), Class: 0.999225, Obj: 0.844893, No Obj: 0.000485, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.802336, GIOU: 0.798664), Class: 0.998920, Obj: 0.955014, No Obj: 0.000785, .5R: 1.000000, .75R: 0.750000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.838987, GIOU: 0.834024), Class: 0.998663, Obj: 0.400468, No Obj: 0.000035, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000282, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.869823, GIOU: 0.867091), Class: 0.999491, Obj: 0.947843, No Obj: 0.000634, .5R: 1.000000, .75R: 1.000000, count: 5
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000002, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.913126, GIOU: 0.911567), Class: 0.999862, Obj: 0.995943, No Obj: 0.000754, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.804345, GIOU: 0.794554), Class: 0.999741, Obj: 0.833474, No Obj: 0.000557, .5R: 1.000000, .75R: 0.666667, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.828259, GIOU: 0.822738), Class: 0.998422, Obj: 0.600344, No Obj: 0.000076, .5R: 1.000000, .75R: 1.000000, count: 3
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.873014, GIOU: 0.870102), Class: 0.999591, Obj: 0.998685, No Obj: 0.001034, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.888265, GIOU: 0.887465), Class: 0.999761, Obj: 0.987195, No Obj: 0.000591, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.792944, GIOU: 0.787508), Class: 0.999825, Obj: 0.907702, No Obj: 0.000157, .5R: 1.000000, .75R: 0.500000, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.900194, GIOU: 0.899056), Class: 0.999739, Obj: 0.997777, No Obj: 0.000506, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.880843, GIOU: 0.879901), Class: 0.999923, Obj: 0.999096, No Obj: 0.000403, .5R: 1.000000, .75R: 1.000000, count: 5
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.834652, GIOU: 0.832130), Class: 0.999865, Obj: 0.769075, No Obj: 0.000301, .5R: 1.000000, .75R: 0.909091, count: 11
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.847607, GIOU: 0.845608), Class: 0.998550, Obj: 0.997036, No Obj: 0.000357, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.828542, GIOU: 0.826807), Class: 0.999834, Obj: 0.938351, No Obj: 0.000534, .5R: 1.000000, .75R: 0.833333, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.807382, GIOU: 0.807382), Class: 0.999645, Obj: 0.446545, No Obj: 0.000044, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000001, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.864837, GIOU: 0.862551), Class: 0.999919, Obj: 0.996243, No Obj: 0.000655, .5R: 1.000000, .75R: 1.000000, count: 5
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.812558, GIOU: 0.807358), Class: 0.999930, Obj: 0.933584, No Obj: 0.000038, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000002, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.897845, GIOU: 0.897455), Class: 0.999608, Obj: 0.984354, No Obj: 0.000419, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.815775, GIOU: 0.806992), Class: 0.999730, Obj: 0.619597, No Obj: 0.000044, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000002, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.862937, GIOU: 0.860239), Class: 0.999918, Obj: 0.991235, No Obj: 0.000616, .5R: 1.000000, .75R: 1.000000, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.841489, GIOU: 0.834102), Class: 0.999776, Obj: 0.703621, No Obj: 0.000030, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.827845, GIOU: 0.826595), Class: 0.999646, Obj: 0.941644, No Obj: 0.001461, .5R: 1.000000, .75R: 1.000000, count: 3
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.832839, GIOU: 0.831670), Class: 0.999925, Obj: 0.993587, No Obj: 0.000677, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.799025, GIOU: 0.795008), Class: 0.913052, Obj: 0.587756, No Obj: 0.000132, .5R: 1.000000, .75R: 0.833333, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.775533, GIOU: 0.769263), Class: 0.999165, Obj: 0.476534, No Obj: 0.000147, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.867817, GIOU: 0.863557), Class: 0.999006, Obj: 0.668676, No Obj: 0.000477, .5R: 1.000000, .75R: 1.000000, count: 3
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.623888, GIOU: 0.616664), Class: 0.546459, Obj: 0.391367, No Obj: 0.000020, .5R: 1.000000, .75R: 0.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.870889, GIOU: 0.869707), Class: 0.999214, Obj: 0.914650, No Obj: 0.001233, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.862204, GIOU: 0.860642), Class: 0.999140, Obj: 0.719939, No Obj: 0.000630, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.805423, GIOU: 0.799391), Class: 0.994189, Obj: 0.102547, No Obj: 0.000026, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000002, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.862386, GIOU: 0.859989), Class: 0.999880, Obj: 0.742697, No Obj: 0.000445, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.791871, GIOU: 0.787106), Class: 0.999460, Obj: 0.744960, No Obj: 0.000040, .5R: 1.000000, .75R: 0.500000, count: 2

 (next mAP calculation at 14700 iterations) 
 Last accuracy mAP@0.5 = 99.35 %, best = 99.43 % 
 14682: 0.278860, 0.259321 avg loss, 0.000010 rate, 7.174890 seconds, 939648 images
Loaded: 0.000033 seconds
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000002, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.810703, GIOU: 0.806056), Class: 0.999030, Obj: 0.744211, No Obj: 0.000674, .5R: 1.000000, .75R: 0.750000, count: 8
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.764298, GIOU: 0.760145), Class: 0.998906, Obj: 0.575124, No Obj: 0.000132, .5R: 1.000000, .75R: 0.600000, count: 5
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000003, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.868377, GIOU: 0.867648), Class: 0.999904, Obj: 0.975032, No Obj: 0.000677, .5R: 1.000000, .75R: 1.000000, count: 7
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.781184, GIOU: 0.778921), Class: 0.999764, Obj: 0.854608, No Obj: 0.000164, .5R: 1.000000, .75R: 0.666667, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.917590, GIOU: 0.916560), Class: 0.999819, Obj: 0.994249, No Obj: 0.000950, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.840999, GIOU: 0.834302), Class: 0.999719, Obj: 0.951601, No Obj: 0.000755, .5R: 1.000000, .75R: 0.714286, count: 7
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.827223, GIOU: 0.823592), Class: 0.999732, Obj: 0.644256, No Obj: 0.000074, .5R: 1.000000, .75R: 0.666667, count: 3
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000233, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.838078, GIOU: 0.837860), Class: 0.999717, Obj: 0.971552, No Obj: 0.000375, .5R: 1.000000, .75R: 1.000000, count: 3
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.840294, GIOU: 0.835282), Class: 0.997959, Obj: 0.265230, No Obj: 0.000010, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000047, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.883361, GIOU: 0.881718), Class: 0.999836, Obj: 0.991195, No Obj: 0.000858, .5R: 1.000000, .75R: 1.000000, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.826935, GIOU: 0.820828), Class: 0.999917, Obj: 0.748244, No Obj: 0.000063, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.816095, GIOU: 0.808041), Class: 0.999662, Obj: 0.978934, No Obj: 0.001594, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.788542, GIOU: 0.782187), Class: 0.999452, Obj: 0.979136, No Obj: 0.000612, .5R: 1.000000, .75R: 0.833333, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.864566, GIOU: 0.859319), Class: 0.999375, Obj: 0.407669, No Obj: 0.000028, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000001, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.840736, GIOU: 0.838519), Class: 0.999748, Obj: 0.875304, No Obj: 0.000537, .5R: 1.000000, .75R: 0.800000, count: 5
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: -nan, GIOU: -nan), Class: -nan, Obj: -nan, No Obj: 0.000001, .5R: -nan, .75R: -nan, count: 0
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.827050, GIOU: 0.824066), Class: 0.998728, Obj: 0.460583, No Obj: 0.000486, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.898753, GIOU: 0.897707), Class: 0.999815, Obj: 0.871375, No Obj: 0.000473, .5R: 1.000000, .75R: 1.000000, count: 4
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.546495, GIOU: 0.494828), Class: 0.977138, Obj: 0.350278, No Obj: 0.000027, .5R: 0.500000, .75R: 0.500000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.878498, GIOU: 0.875214), Class: 0.999045, Obj: 0.600723, No Obj: 0.000620, .5R: 1.000000, .75R: 1.000000, count: 2
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.869378, GIOU: 0.867205), Class: 0.999579, Obj: 0.939749, No Obj: 0.000715, .5R: 1.000000, .75R: 1.000000, count: 6
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.817488, GIOU: 0.814568), Class: 0.999738, Obj: 0.601861, No Obj: 0.000276, .5R: 1.000000, .75R: 1.000000, count: 9
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 82 Avg (IOU: 0.889346, GIOU: 0.886728), Class: 0.999476, Obj: 0.954856, No Obj: 0.000708, .5R: 1.000000, .75R: 1.000000, count: 1
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 94 Avg (IOU: 0.858460, GIOU: 0.854488), Class: 0.999810, Obj: 0.926675, No Obj: 0.000816, .5R: 1.000000, .75R: 1.000000, count: 8
v3 (mse loss, Normalizer: (iou: 0.750000, cls: 1.000000) Region 106 Avg (IOU: 0.831838, GIOU: 0.831819), Class: 0.999879, Obj: 0.682484, No Obj: 0.000056, .5R: 1.000000, .75R: 1.000000, count: 1
^C

wiwao@wiwao-desktop:~/darknet$ 

これで一旦終了。


一応学習再開の方法を試す。。。
wiwao@wiwao-desktop:~/darknet$ ./darknet detector train cfg/obj.data cfg/yolo-obj.cfg darknet53.conv.74 -map
 Prepare additional network for mAP calculation...
で同じコマンドを使ってしまったので途中で気がついてストップ。。。
なのでyolo-obj_1000.weightsは間違ったところで上書きされていると思います。
なので使えない。
./darknet detector train cfg/obj.data cfg/yolo-obj.cfg backup/yolo-obj_14000.weights
で再スタート
このプロセス作った人は天才ですね。
作業を理解するだけでも大変です。

これで学習フェイズ終了





2019年10月6日日曜日

やはりこの辺は手間と時間がかかります。

AIメンテくんの作業を始めようと準備していますが、やはり初めてなので戸惑う事ばかり。先人のマニュアルがあるとはいえケースによって自分で試行錯誤しないと結果に当惑しそうです。
先ず、セルの発熱をジャンクションボックスの発熱はOKでホットスポットはNGと分類を作って行くのが最初にあります。その後データの範囲をどうするかも良く考えると難しい事がわかりました。
つまりパネルにまばらにホットスポットがある場合は恐らく雷による損傷ですが、そのまばらのホットスポットを1つ1つを囲って認識出来るか?
ストリングエラーは簡単ですが、ここのエラーの判定の教師データを作るのが一苦労。
で、またアノテーションソフトのインストールもドライバーから不明なエラーを吐かれて右往左往。
毎日持ち歩くノートブック(MAC)にインストールとすると他のアプリと競合して下手にライブラリーを触るとメインのノートが逝ってしまうと困るし。
仕事の合間に段取りを試して帰宅後インストールに失敗して修正して休み丸一日消費します。
今更ですがマニュアル通りに行きません。悩んで半日を過ごして半日試行錯誤…
コマンド操作もう一度思い出さなくては。

をよく読んで下さい。この解説は唯一の教科書です。

アノテーションから

git clone https://github.com/tzutalin/labelImg.git
sudo apt install pyqt5-dev-tools
cd labelImg
make qt5py3

次にlabelimg/data の中にあるpredefined_class.txtを修正します(これが一番手っ取り早い)。最初は20クラスぐらいあらかじめ書き込んでありますが、今回は3クラスだけなので、既に書き込んであるクラス名を全部消し、自分の好きな名称でクラス名を改行して書き込みます。今回はguu、tyoki、paaにしました。これは必ず修正が必要です。
labelimgフォルダの中でプログラムを実行します。
 python3 labelImg.py

以下のような画面が表示されるので、次のような設定を行います。

OpenDir で先ほど作ったイメージデータが入っているディレクトリを指定
Change Save Dir で同じディレクトリを選択。イメージもアノテーション
ファイルも同じディレクトリに入れちゃいます。
さらにSaveの下にある PscalVOC を選択して、必ずYOLOに変更します。
これを忘れると、最初からやり直しになるので注意。
 そして上部のメニューバーからView->Single Class Modeにチェックを入れます。
Single Class Modeとはクラス名が同一の場合、連続でデータを入力できるので、1つのクラスに対応したjpeg画像がここで生きることになります。但しSingle Class Modeにすると最初だけClass名選択をする必要があります。

yoloの下準備

Darknetをインストールするとdarknetディレクトリができます。
darknet/data の中に先ほど作ったjpgとtxtの入ったごちゃ混ぜデータをディレクトリごと移動またはコピー。

 その中にprocess.pyの名称で、以下の内容のファイルを作成

import glob, os

# Current directory
current_dir = os.path.dirname(os.path.abspath(__file__))

# Directory where the data will reside, relative to 'darknet.exe'
path_data = 'data/Murou/'

# Percentage of images to be used for the test set
percentage_test = 10;

# Create and/or truncate train.txt and test.txt
file_train = open('train.txt', 'w')  
file_test = open('test.txt', 'w')

# Populate train.txt and test.txt
counter = 1  
index_test = round(100 / percentage_test)  
for pathAndFilename in glob.iglob(os.path.join(current_dir, "*.jpg")):  
    title, ext = os.path.splitext(os.path.basename(pathAndFilename))

    if counter == index_test:
        counter = 1
        file_test.write(path_data + title + '.jpg' + "\n")
    else:
        file_train.write(path_data + title + '.jpg' + "\n")
        counter = counter + 1

実行方法は、
   python process.py
 実行環境はPython2である事に注意です。画像が不足していると感じた場合は、追加画像群を他の場所でアノテーションして、すべてこの場所に放り込み、再度python 
process.pyを実行するだけです(その場合は画像名称を変えることを忘れずに!!)。
また ./darknet detector train cfg/obj.data cfg/yolov3.cfg darknet53.conv.74 -map
として-map を付けないとどこまでの精度が確保できているかグラフが出てきません。
yolov3.cfg または yolov3_voc.cfg (yolov3シリーズのcfgファイル)を使って下さい。 

Yolov3.voc の変更点は 
3,4行にコメントを入れる
5,6行のコメントを外す
20行目の max_bachesを30000くらいにする
22行目 steps=4000,4500 くらいにする
603,610,689,696,776,783行に書いてある
filters=255
classes=80

の所をクラスが3なら

filters=24
classes=3

に変更します filtersは (クラス数+5)X3  の数値です

darknet/cfgの中にobj.namesファイルを作成
  obj.names :先ほどのpredefined_class.txtと内容が同じファイル。
        クラス名を改行しながら書きます。今回はGoo、Tyoki、Paa
f:id:TAKEsan:20180815230202p:plain
  obj.data    :必要ファイルのリンクを書き込んだファイル。以下のような感じ。
      class   必ず指定。今回の場合3
      train ディレクトリとファイル名を指定 先ほどのtrain.txt
      valid ディレクトリとファイル名を指定 先ほどのtest.txt
      names   クラスファイルの場所とファイル名 obj.names
      backup  学習済みデータの保存先 このままでOK

f:id:TAKEsan:20180815230221p:plain


The program 'git' is currently not installed. You can install it by typing:
sudo apt install git
wiwao@wiwao:~$ sudo apt install git
[sudo] password for wiwao: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 cuda-samples-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.1.0.105) but it is not going to be installed
 git : Depends: liberror-perl but it is not going to be installed
       Depends: git-man (> 1:2.7.4) but it is not going to be installed
       Depends: git-man (< 1:2.7.4-.) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
wiwao@wiwao:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  cuda-command-line-tools-10-0 cuda-command-line-tools-10-1 cuda-compiler-10-0
  cuda-compiler-10-1 cuda-cublas-10-0 cuda-cublas-dev-10-0 cuda-cudart-10-0
  cuda-cudart-10-1 cuda-cudart-dev-10-0 cuda-cudart-dev-10-1 cuda-cufft-10-0
  cuda-cufft-10-1 cuda-cufft-dev-10-0 cuda-cufft-dev-10-1 cuda-cuobjdump-10-0
  cuda-cuobjdump-10-1 cuda-cupti-10-0 cuda-cupti-10-1 cuda-curand-10-0
  cuda-curand-10-1 cuda-curand-dev-10-0 cuda-curand-dev-10-1
  cuda-cusolver-10-0 cuda-cusolver-10-1 cuda-cusolver-dev-10-0
  cuda-cusolver-dev-10-1 cuda-cusparse-10-0 cuda-cusparse-10-1
  cuda-cusparse-dev-10-0 cuda-cusparse-dev-10-1 cuda-documentation-10-0
  cuda-documentation-10-1 cuda-driver-dev-10-0 cuda-driver-dev-10-1
  cuda-gdb-10-0 cuda-gdb-10-1 cuda-gpu-library-advisor-10-0
  cuda-gpu-library-advisor-10-1 cuda-libraries-10-0 cuda-libraries-10-1
  cuda-libraries-dev-10-0 cuda-libraries-dev-10-1 cuda-license-10-0
  cuda-license-10-1 cuda-memcheck-10-0 cuda-memcheck-10-1
  cuda-misc-headers-10-0 cuda-misc-headers-10-1 cuda-npp-10-0 cuda-npp-10-1
  cuda-npp-dev-10-0 cuda-npp-dev-10-1 cuda-nsight-10-0 cuda-nsight-10-1
  cuda-nsight-compute-10-0 cuda-nsight-compute-10-1 cuda-nsight-systems-10-1
  cuda-nvcc-10-0 cuda-nvcc-10-1 cuda-nvdisasm-10-0 cuda-nvdisasm-10-1
  cuda-nvgraph-10-0 cuda-nvgraph-10-1 cuda-nvgraph-dev-10-0
  cuda-nvgraph-dev-10-1 cuda-nvjpeg-10-0 cuda-nvjpeg-10-1 cuda-nvjpeg-dev-10-0
  cuda-nvjpeg-dev-10-1 cuda-nvml-dev-10-0 cuda-nvml-dev-10-1 cuda-nvprof-10-0
  cuda-nvprof-10-1 cuda-nvprune-10-0 cuda-nvprune-10-1 cuda-nvrtc-10-0
  cuda-nvrtc-10-1 cuda-nvrtc-dev-10-0 cuda-nvrtc-dev-10-1 cuda-nvtx-10-0
  cuda-nvtx-10-1 cuda-nvvp-10-0 cuda-nvvp-10-1 cuda-samples-10-0
  cuda-samples-10-1 cuda-sanitizer-api-10-1 cuda-toolkit-10-0
  cuda-toolkit-10-1 cuda-tools-10-0 cuda-tools-10-1 cuda-visual-tools-10-0
  cuda-visual-tools-10-1 gir1.2-keybinder-3.0 libcublas-dev libcublas10
  libkeybinder-3.0-0 linux-headers-4.15.0-42 linux-headers-4.15.0-42-generic
  linux-image-4.15.0-42-generic linux-modules-4.15.0-42-generic
  linux-modules-extra-4.15.0-42-generic snapd-login-service
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libcublas-dev
The following NEW packages will be installed:
  libcublas-dev
0 upgraded, 1 newly installed, 0 to remove and 334 not upgraded.
7 not fully installed or removed.
Need to get 0 B/38.9 MB of archives.
After this operation, 109 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 302549 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.2.1.243-1_amd64.deb ...
Unpacking libcublas-dev (10.2.1.243-1) ...
dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.2.1.243-1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libcublas_static.a', which is also in package nvidia-cuda-dev 7.5.18-0ubuntu1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libcublas-dev_10.2.1.243-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
wiwao@wiwao:~$ 

wiwao@wiwao-desktop:~/darknet$ make -j16
mkdir -p obj
mkdir -p backup
mkdir -p results
chmod +x *.sh
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/image_opencv.cpp -o obj/image_opencv.o
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/http_stream.cpp -o obj/http_stream.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/gemm.c -o obj/gemm.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/utils.c -o obj/utils.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/dark_cuda.c -o obj/dark_cuda.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/convolutional_layer.c -o obj/convolutional_layer.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/list.c -o obj/list.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/image.c -o obj/image.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/activations.c -o obj/activations.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/im2col.c -o obj/im2col.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/col2im.c -o obj/col2im.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/blas.c -o obj/blas.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/crop_layer.c -o obj/crop_layer.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/dropout_layer.c -o obj/dropout_layer.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/maxpool_layer.c -o obj/maxpool_layer.o
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/softmax_layer.c -o obj/softmax_layer.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
./src/activations.c: In function ‘activate’:
./src/activations.c:68:5: warning: enumeration value ‘SWISH’ not handled in switch [-Wswitch]
     switch(a){
     ^~~~~~
./src/activations.c: In function ‘gradient’:
./src/activations.c:138:5: warning: enumeration value ‘SWISH’ not handled in switch [-Wswitch]
     switch(a){
     ^~~~~~
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/data.c -o obj/data.o
./src/dark_cuda.c: In function ‘get_cuda_stream’:
./src/dark_cuda.c:120:18: warning: unused variable ‘buffer’ [-Wunused-variable]
             char buffer[256];
                  ^~~~~~
./src/dark_cuda.c: In function ‘get_cuda_memcpy_stream’:
./src/dark_cuda.c:141:18: warning: unused variable ‘buffer’ [-Wunused-variable]
             char buffer[256];
                  ^~~~~~
./src/dark_cuda.c: In function ‘cudnn_handle’:
./src/dark_cuda.c:161:23: warning: unused variable ‘status’ [-Wunused-variable]
         cudnnStatus_t status = cudnnSetStream(handle[i], get_cuda_stream());
                       ^~~~~~
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/matrix.c -o obj/matrix.o
./src/http_stream.cpp:306:10: fatal error: opencv2/opencv.hpp: No such file or directory
 #include <opencv2/opencv.hpp>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
./src/image_opencv.cpp:15:10: fatal error: opencv2/core/version.hpp: No such file or directory
 #include <opencv2/core/version.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:149: recipe for target 'obj/http_stream.o' failed
make: *** [obj/http_stream.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:149: recipe for target 'obj/image_opencv.o' failed
make: *** [obj/image_opencv.o] Error 1
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
./src/gemm.c: In function ‘convolution_2d’:
./src/gemm.c:2037:15: warning: unused variable ‘out_w’ [-Wunused-variable]
     const int out_w = (w + 2 * pad - ksize) / stride + 1;    // output_width=input_width for stride=1 and pad=1
               ^~~~~
./src/gemm.c:2036:15: warning: unused variable ‘out_h’ [-Wunused-variable]
     const int out_h = (h + 2 * pad - ksize) / stride + 1;    // output_height=input_height for stride=1 and pad=1
               ^~~~~
./src/convolutional_layer.c: In function ‘forward_convolutional_layer’:
./src/convolutional_layer.c:1097:32: warning: unused variable ‘t_intput_size’ [-Wunused-variable]
                         size_t t_intput_size = binary_transpose_align_input(k, n, state.workspace, &l.t_bit_input, ldb_align, l.bit_align);
                                ^~~~~~~~~~~~~
./src/maxpool_layer.c: In function ‘cudnn_maxpool_setup’:
./src/maxpool_layer.c:27:19: warning: variable ‘maxpool_status’ set but not used [-Wunused-but-set-variable]
     cudnnStatus_t maxpool_status;
                   ^~~~~~~~~~~~~~
./src/data.c: In function ‘load_data_detection’:
./src/data.c:892:19: warning: unused variable ‘scale’ [-Wunused-variable]
             float scale = rand_precalc_random(.25, 2, r_scale); // unused currently
                   ^~~~~