Inverse design using neural network(nanoparticle)---Read Me

本文介紹一下對一篇用neural network做inverse design的工作的學習课兄。
文章地址:Nanophotonic particle simulation and inverse design using artificial neural networks距辆;
代碼地址:https://github.com/iguanaus/ScatterNet


Scatter Net     
  '.\|/.'         
  (\   /)         
  - -O- -         
  (/   \)         
  ,'/|\'.         

Scatter Net

An example repository of using machine learning to solve a physics problem. Based on the work presented in, Nanophotonic Particle Simulation and Inverse Design Using Artificial Neural Networks (https://arxiv.org/abs/1712.03222). This repository is specifically designed for solving inverse design problems, particularly surrounding photonics and optics.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. This example will also generate Table I in the paper, and Figure 2,3, and 4.

Prerequisites

To run the Matlab code, Matlab will need to be installed. For this code, we used Matlab R2017a. Note that the project can be done without Matlab, but comparisons of speed and data generation cannot be done unless Matlab is installed.
(數(shù)據(jù)可以用matlab生成亲怠,提供的analytical的解出alternative的多層球的散射譜)

This codebase is based on Python 2.7, and the pip packages used are shown in the requirements.txt file. To run this on AWS, use AMI ami-52bb0c32, and a p2.xlarge instance.
代碼用的是python2.7寫的;并且用的是GPU來計算某筐;我們沒有GPU所以只用CPU計算武学。requirements中給出了很多packges,我們并沒有全部安裝挡爵。一般是運行起來之后,缺什么包再補充就好了

Installing

  1. Copy the github repo to your computer, and install the pip requirements.
git clone https://github.com/iguanaus/ScatterNet.git
cd ScatterNet
pip install -r requirements.txt

并沒有全部安裝requirements中的文件甚垦。我們用anaconda創(chuàng)建了一個python2.7的環(huán)境茶鹃,然后再安裝conda install matplotlib,conda install tensorfolw==1.14,conda install scikit-learn三個包就可以了

  1. Option 1: Fetch the data
cd data
sh fetchData.sh
  1. Option 2: View and Generate the data
scatter_sim_1_plot_data.m
scatter_sim_2_gen_data.m

有兩種獲取數(shù)據(jù)的方法,Option 1是直接下載數(shù)據(jù)艰亮,Option 2 是用matlab自己生成數(shù)據(jù)

  1. Option 1: Fetch the models
cd results
sh fetchResults.sh
  1. Option 2: Train the models (Table I)
sh demo.sh

有兩種獲取model的方法闭翩。一種是作者訓練好了的可以直接下載(option 1),另一種是用demo.sh的腳本文件調用python自己訓練

  1. Compare spetrums (Figure 2)
sh demo_compareSpect.sh
  1. Perform Inverse Design (Figure 3)
sh demo_matchSpect.sh
  1. Perform Optimization (Figure 4)
sh demo_designSpect.sh

Structure

ScatteringNet_Matlab:
This is the matlab code repository, intended to be run on a cluster or a high performance computer. Depends on matlab.

ScatteringNet_Tensorflow:
This is the tensorflow/python repository, intended to be run on a computer with a GPU and tensorflow capabilities.

Flow:

  1. scatter_0_generate_spectrum
    Pick the settings for your data in the scatter_0_generate_spectrum.
  2. scatter_1_plot_sample
    Run the scatter_1_plot_sample to get an idea of what the data looks like.
    Make sure the data set is hollistics enough/has interesting features within it.
    Save these graphs, so you have an idea of what the data looks like.
    plotLoss.py is your friend.
    Use the pullFiles.sh script to pull the data locally from the server.
  3. scatter_2_generate_train
    Once you have that, run the scatter_2_generate_train on a cluster
    I recommend first changing the settings, then pushing it to the server.
  4. scatter_net_1_train
    Once you have the data, run the scatter_net_1_train to train the neural network on a GPU.
    Graph the loss.
  5. scatter_net_2_compareSpects
    Once you have the trained neural network, run the scatter_net_2_compareSpects.py to sample some spects and see what they are.
    Run plotSpects.py to see what these spectrums look like.
  6. scatter_3_generate_single_test
    Pick a spectrum, generate the data, move it over to the other repository.
  7. scatter_net_3_matchSpect
    See how it matches the spectrum.
  8. scatter_4_graph_geometry
    See how it did
  9. scatter_net_4_design.py
    Pick an optimal figure of merit, and then run this.
  10. scatter_5_graph_desired
    Graph the desired on top.

Contributing

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Hat tip to anyone who's code was used
  • Inspiration
  • etc

Scatter Net     
  '.\|/.'         
  (\   /)         
  - -O- -         
  (/   \)         
  ,'/|\'.         

MIT Department of Physics. All rights reserved.
Version 1.0 - 06/10/2017
Produced and used by John Peurifoy. Assistance and guidance provided by: Li Jing, Yichen Shen, and Yi Yang. Updates and code fixes provided by Samuel Kim.
A product of a collaboration between Max Tegmark's and Marin Soljacic's group.
Originally created 04/24/2017

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末迄埃,一起剝皮案震驚了整個濱河市疗韵,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌侄非,老刑警劉巖蕉汪,帶你破解...
    沈念sama閱讀 206,311評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件流译,死亡現(xiàn)場離奇詭異,居然都是意外死亡肤无,警方通過查閱死者的電腦和手機先蒋,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,339評論 2 382
  • 文/潘曉璐 我一進店門骇钦,熙熙樓的掌柜王于貴愁眉苦臉地迎上來宛渐,“玉大人,你說我怎么就攤上這事眯搭】妫” “怎么了?”我有些...
    開封第一講書人閱讀 152,671評論 0 342
  • 文/不壞的土叔 我叫張陵鳞仙,是天一觀的道長寇蚊。 經(jīng)常有香客問我,道長棍好,這世上最難降的妖魔是什么仗岸? 我笑而不...
    開封第一講書人閱讀 55,252評論 1 279
  • 正文 為了忘掉前任,我火速辦了婚禮借笙,結果婚禮上扒怖,老公的妹妹穿的比我還像新娘。我一直安慰自己业稼,他們只是感情好盗痒,可當我...
    茶點故事閱讀 64,253評論 5 371
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著低散,像睡著了一般俯邓。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上熔号,一...
    開封第一講書人閱讀 49,031評論 1 285
  • 那天稽鞭,我揣著相機與錄音,去河邊找鬼引镊。 笑死川慌,一個胖子當著我的面吹牛,可吹牛的內容都是我干的祠乃。 我是一名探鬼主播梦重,決...
    沈念sama閱讀 38,340評論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼亮瓷!你這毒婦竟也來了琴拧?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 36,973評論 0 259
  • 序言:老撾萬榮一對情侶失蹤嘱支,失蹤者是張志新(化名)和其女友劉穎蚓胸,沒想到半個月后挣饥,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,466評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡沛膳,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 35,937評論 2 323
  • 正文 我和宋清朗相戀三年扔枫,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片锹安。...
    茶點故事閱讀 38,039評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡短荐,死狀恐怖,靈堂內的尸體忽然破棺而出叹哭,到底是詐尸還是另有隱情忍宋,我是刑警寧澤,帶...
    沈念sama閱讀 33,701評論 4 323
  • 正文 年R本政府宣布风罩,位于F島的核電站糠排,受9級特大地震影響,放射性物質發(fā)生泄漏超升。R本人自食惡果不足惜入宦,卻給世界環(huán)境...
    茶點故事閱讀 39,254評論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望室琢。 院中可真熱鬧乾闰,春花似錦、人聲如沸研乒。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,259評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽雹熬。三九已至宽菜,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間竿报,已是汗流浹背铅乡。 一陣腳步聲響...
    開封第一講書人閱讀 31,485評論 1 262
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留烈菌,地道東北人阵幸。 一個月前我還...
    沈念sama閱讀 45,497評論 2 354
  • 正文 我出身青樓,卻偏偏與公主長得像芽世,于是被迫代替她去往敵國和親挚赊。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 42,786評論 2 345

推薦閱讀更多精彩內容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,292評論 0 10
  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,389評論 0 23
  • 什么是去中心化交易所济瓢? 去中心化交易所是一個術語用于任何在沒有中心化控制下的情況下進行交易荠割。在一個專注于準確性的行...
    polkadot閱讀 509評論 0 0
  • 今日一笑 去市場買菜,想買兩根香蕉,賣家說兩根咋賣呀蔑鹦,旁邊有人助我跟賣家說掰兩根就行呀夺克,一樣賣。買完轉頭要走嚎朽,又有...
    彩虹島主閱讀 143評論 0 0
  • 每個月末都要自己做一次報銷铺纽,掃描發(fā)票,核對賬目哟忍,寫上個月工作匯報狡门,交給審核的同事。尤其是計算賬目時候魁索,簡直是頭大融撞,...
    不想說隨心活閱讀 199評論 0 0