Skip to main content

 Some notes to the Fastai course

Practical Deep Learning for Coders 2022


If you intend use Pytorch and python 3.7 for adopting fastai core, maybe you got some problems and this pages will collect the error which I have search and solve some problems

Lession 1:


Bug 1: If you use windows and it cant create a folder and download data as below:


searches = 'forest','bird'
path = Path('bird_or_not')

if not path.exists():
    path.mkdir() ### Very important to make path, will not run if not make
    for o in searches:
        dest = (path/o)
        print(o)
        dest.mkdir(exist_ok=True)
        results = search_images_ddg(f'{o} photo')
        download_images(dest, urls=results[:200])
        resize_images(dest, max_size=400, dest=dest, max_workers=1)
        ### Using max_workers=1 to solve problem of multiprocessing lack support from system

Use the command path.mkdir() will permit create folder in current workbook of windows system

Use max_workers=1 will solve the problems of BrokenProcessPool. python - How to fix BrokenProcessPool: error for concurrent.futures ProcessPoolExecutor - Stack Overflow

I guess that this arose since the pytorch not support to multiprocessing well in miniconda envinronment.


For the verify_images error in the commands:

failed = verify_images(get_image_files(path))
failed.map(Path.unlink)

we can replace with:

failed = L(fns[i] for i,o in enumerate(parallel(verify_image, get_image_files(path), n_workers=1)) if not o)
failed.map(Path.unlink)



Comments

Popular posts from this blog

Tự nhiên

Tự nhiên là những gì thuộc về tính tự có vốn là của nó, không có sự giải thích nào cho tự nhiên cả. Đó gọi là tự nhiên như cái tên mang ý nghĩa của nó vậy. Khoa học tự nhiên là khoa học liên quan tới nghiên cứu và tìm hiểu các vấn đề thuộc về đặc tính vốn có của sự vật theo một hình thức tự nó mà không phải là do con người tạo ra. Theo đó toán học, lý học, hóa học được xem là các ngành khoa học tự nhiên. Thật ra toán học nên được xem là ngành khoa học xã hội hơn là tự nhiên, vì về bản chất, toán học là thứ ngôn ngữ do con người sáng tạo ra. Vì thế nó mang những hình thái phụ thuộc vào nhận thức và cảm quan của người sáng tạo ra nó. Tuy nhiên toán học mang đặc tính tự nhiên ở chỗ, nó là phương tiện được xây dựng để mô tả đường lối của tự nhiên.
Experiment to CC2640R2 and Sensor Booster Pack In this example, I follow a tutorial from TI to read sensor OTP3001. http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_1_13_02_07/modules/ble_02_thermostat/ble_02_thermostat.html Because the sensor TMP0007 has out of date now, so I little modify to use with OTP3001. Step1. Copy file i2ctmp from simpllink sdk  cc2640R2 version Reference The Booster pack datasheet  http://www.ti.com/lit/ug/slau666b/slau666b.pdf TMP0007 and OTP3001 share the I2C bus including SCL, SDA.  Address's  TMP is 0x04, Data Register: 0x00 Address's OTP is 0x47, DataRegister: 0x00  So in the code we modify: #define OTP3001_REG         0x0000  /* Die Temp Result Register for TMP006 */ #define OTP3001_ADDR        0x47; According to OTP3001 datasheet, in default, a configuration register (address 0x01) in sleep mode, so if we read data ou...
Some stuff are useful for C# programming Dial, KNob, Button and LED indicator https://www.codeproject.com/Articles/36116/Industrial-Controls-2 Gauge https://www.codeproject.com/Articles/448721/AGauge-WinForms-Gauge-Control http://www.codearteng.com/2012/08/agauge-winforms-gauge-control.html Scott Plot https://github.com/swharden/ScottPlot#cookbook DSP toolbox http://www.codearteng.com/2012/08/agauge-winforms-gauge-control.html