2017-02-14 33 views
0

我按照在Link引導直到Deepdream Python腳本未示出的圖像

_=deepdream(net, img) 

步驟。現在它運行沒有錯誤,但它不顯示圖像。這是輸出:

<IPython.core.display.Image object> 
0 0 inception_4c/output (210, 373, 3) 
<IPython.core.display.Image object> 
0 1 inception_4c/output (210, 373, 3) 
<IPython.core.display.Image object> 
0 2 inception_4c/output (210, 373, 3) 

它繼續進行類似的輸出。

我可以給這個代碼的文件:

im = PIL.Image.open('sky1024px.jpg') 
im.show() 

不過,這並不與該指南提供的代碼工作。唯一看起來很奇怪的是,當我使用f.getvalue()打印時,f(StringIO)包含「垃圾」。

任何洞察力爲什麼它不顯示圖像?

編輯: 如果我改變行(showarray法)

PIL.Image.fromarray(a).save(f, fmt) 

PIL.Image.fromarray(a).save('/home/jose/Downloads/deepdream/test', fmt) 

它不顯示圖像,但至少它是將其保存在指定文件夾。

編輯2: 改變線

display(Image(data=f.getvalue())) 

im = PIL.Image.open('/home/jose/Downloads/deepdream/test') 

示出了圖像。現在的問題是,我無法關閉它,因此它顯示了一個在其他人之上。

回答

0

改變線

display(Image(data=f.getvalue())) 

im = PIL.Image.open('/home/jose/Downloads/deepdream/test') 

示出了圖像。現在的問題是,我無法關閉它,因此它顯示了一個在其他人之上。