We are currently conducting deep learning in our lab using Windows-WSL2-Ubuntu20.02-(Xfce4)-Miniconda-pip-PyTorch-JetBrainsToolbox-PyCharm, as it provides a good GPU execution environment and version management for Python modules. However, we are considering switching to Ubuntu, which seems more appropriate than Windows-WSL2. We also anticipate using Docker. Occasionally, we need to use Word or Excel, so we're wondering how to manage that (Can Excel and Word be used on Linux?). Could you please advise?
どうやらWSL2+PyTorchは安定している.少なくとも,detectron2は,今のところ動いている.(WSLは250GB以上に割り当てできないのか?そんなことはないよう(Windows10はダメで,Windows11ならOKか?)です.こんな方法も.resize2fsコマンドを使用)
抽出したい領域を指定(マスクやアノテーション,ラベリング)したい際などに使用する.
そこから学習データとして画像で扱うならば(デフォルトはjsonファイル),そのフォーマットに関してRGBモード,Palleteモードが関わる(変換が必要な)ときがあり,その際はPythonのPillowモジュールの利用がいいのかも?画像の見た目ではモードの違いは分からない。(CycleGAN(特別な使い方ですが)や物体検出系の深層学習モデルで使用する際に)
ここで大事なのは,後々の深層学習モデルで指定されるのはRGBモードかパレットモードか?
python labelme_json_to_png_L.py /mnt/c/Users/landslide/Desktop/niiyama/test_input -o=/mnt/c/Users/landslide/Desktop/niiyama/test_input_b -class_name="guardrail b" -pixel_value=255
python C:\Users\d18036\Desktop\labelme-main\examples\instance_segmentation\labelme2coco.py "C:\Users\d18036\Desktop\hodoukyou2023\hodoukyou-iroiro\kiritori-rear\test" "C:\Users\d18036\Desktop\hodoukyou2023\hodoukyou-iroiro\kiritori-rear\kiritori-henkan3" --labels "C:\Users\d18036\Desktop\hodoukyou2023\labels.txt"なお,ここで使用するlabels.txtの中身は
__ignore__ _background_ raillabelme2coco.pyの
for shape in label_file.shapes: points = shape["points"] label = shape["label"] group_id = shape.get("group_id") shape_type = shape.get("shape_type", "polygon") if shape_type == "rectangle": (x1, y1), (x2, y2) = points x1, x2 = sorted([x1, x2]) y1, y2 = sorted([y1, y2]) points = [(x1, y1), (x2, y2)] mask = labelme.utils.shape_to_mask(img.shape[:2], points, shape_type) ...としたら(If文のところの挿入,mask=の前まで.)いいようです.
転移学習のプログラムができた.
(いまのところ回帰のプログラム.)
ここのtqdmとかのブランチにある以下のファイル.
画像データセットと属性ファイルをTraining-Validation,Testに分けるプログラムができた.
(なぜ,Training-Validation,Testかというと,K-foldを使用前提)
jupyter nbconvert --to script input_file.ipynb
Roboflow could be versatile and useful.
pix2pixとCycleGANは,PyTorch系のこのプログラムを使います.
★ノーマルモード
python train.py --dataroot ./datasets/yellow2brown/ --name yellow2brown7 --model cycle_gan --gpu_ids 1 --n_epochs 200 --lr 0.0005 python train.py --dataroot ./datasets/yellow2brown/ --name yellow2brown7 --model cycle_gan --gpu_ids 1
★マスク適用
訓練:
python train_mask.py --dataroot ./datasets/yellow2brown_mask_new/ --name yellow2brown_mask_new3 --model cycle_gan_mask --gpu_ids 1 --n_epochs 200 --lr 0.0005 --mask_weight 1 --dataset_mode unalignedmask
python train_mask.py --dataroot ./datasets/yellow2brown_cut_mask/ --name yellow2brown_cut_mask_weight_3_norm --model cycle_gan_mask_norm --gpu_ids 0 --n_epochs 100 --mask_weight 3 --dataset_mode unalignedmask --load_size 256 --preprocess resize
テスト:
python test.py --dataroot ./datasets/yellow2brown_mask --name yellow2brown_mask150 --model cycle_gan --epoch 150 --gpu_ids 1
python test.py --dataroot ./datasets/yellow2brown_cut_mask --name yellow2brown_cut_mask_weight_0t1_norm --model cycle_gan_mask_norm_test --epoch 5 --gpu_ids 0 --phase test
ここで、
Train/Test Tips 日本語
dataset例
マスクデータ例