のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

fastai

fastaiで、confusion_matrixの計算が、CPU側へ持ってくると、1/3になった。

3000クラスぐらいのconfusion_matrixの計算をすると時間が20分ぐらいかかった。 fastaiの、confusion_matrixの計算を,Tensorから、CPU側へ持ってきたら、1/3になった。 #かなり、時間がかかる20分ぐらいかかる import time t1 = time.time() interp.confus…

fastai split_by_idx

fastai split_by idxs forums.fast.ai

fastaiのplot_confusion_matrixでメモリが足りなくなる

interp.plot_confusion_matrix(figsize=(12,12), dpi=60) メモリが足りなくなったとき、slice_sizeを変えればいいようだ。 Working with large datasets When working with large datasets, memory problems can arise when computing the confusion matrix.…

lr_find

グラフの格好が変な気がする。lr_find learn.fit_one_cycle(4) Total time: 00:40 epoch train_loss valid_loss error_rate 1 0.951892 0.274480 0.116071 2 0.538885 0.122095 0.062500 3 0.378222 0.124518 0.053571 4 0.288617 0.122597 0.053571でも、良…

google image download to text

urls = Array.from( document.querySelectorAll('.rg_di .rg_meta') ).map(el=>JSON.parse(el.textContent).ou); window.open('data:text/csv;charset=utf-8,' + escape(urls.join('\n'))); developer.mozilla.orgdeveloper.mozilla.orgjs.studio-kingdom.com

python 正規表現

pat= r'/([^/]+)_\d+.jpg$' data = ImageDataBunch.from_name_re( path_img, fnames, pat, ds_tfms=get_transforms(), size=224, bs=bs ).normalize(imagenet_stats) qiita.com:embed:cite]https://www.debuggex.com/?re=&str=

ifnoneは、coreの関数

def ifnone(a:Any,b:Any)->Any: "`a` if `a` is not None, otherwise `b`." return b if a is None else a https://github.com/fastai/fastai/blob/master/fastai/core.py 「aがNoneでなければa、そうでなければbです。」 def test_ifnone(): assert ifnone(…

untar_data

def untar_data( url:str, fname:PathOrStr=None, dest:PathOrStr=None, data=True, force_download=False) -> Path: "Download `url` to `fname` if it doesn't exist, and un-tgz to folder `dest`." dest = url2path(url, data) if dest is None else Pat…

fast.aiをgoogle colabで実行する方法

Python3のGPUありの設定で動作した。共有ファイルを参照する方法を利用させてもらった。 qiita.com !pip install -U -q PyDrivefrom pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2clien…

paperspaceにアカウントを作ってみた

github.com