最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python?DPED機(jī)器學(xué)習(xí)之實(shí)現(xiàn)照片美化

 更新時(shí)間:2021年11月29日 08:47:41   作者:劍客阿良_ALiang  
本篇文章主要介紹了利用Python中的DPED工具實(shí)現(xiàn)照片一鍵美化,可以實(shí)現(xiàn)照片亮度提高和色彩鮮明度提高,代碼簡潔易懂,具有一定學(xué)習(xí)價(jià)值,感興趣的小伙伴可以了解一下

前言

最近發(fā)現(xiàn)了一個(gè)可以把照片美化的項(xiàng)目,自己玩了玩,挺有意思的,分享一下。

Github地址:DPED項(xiàng)目地址

下面來看看項(xiàng)目怎么玩?先放一些項(xiàng)目給出的效果圖??梢钥闯稣掌髁梁每戳恕?/span>

環(huán)境部署

項(xiàng)目結(jié)構(gòu)

下面是項(xiàng)目的原始結(jié)構(gòu):

tensorflow安裝

按照項(xiàng)目的說明,我們需要安裝tensorflow以及一些必要的庫。

如果安裝gpu版本的tensorflow需要對照一下

tensorflow官方對照地址:TensorFlow官方CUDA版本對照

我的cuda是11.1的版本,按照tensorflow后還是缺少部分dll,如果有相同問題的,可以用我提供的資源包? 提取碼:TUAN。

缺少哪個(gè)dll,直接復(fù)制到你的NVIDIA GPU Computing Toolkit目錄對應(yīng)cuda的bin目錄下。

按照自己的版本來,我的tensorflow命令如下:

pip install tensorflow-gpu==2.4.2 -i https://pypi.douban.com/simple
pip install tf-nightly -i https://pypi.douban.com/simple

其他依賴安裝

Pillow, scipy, numpy, imageio安裝

pip install Pillow -i https://pypi.douban.com/simple
pip install scipy -i https://pypi.douban.com/simple
pip install numpy -i https://pypi.douban.com/simple
pip install imageio -i https://pypi.douban.com/simple

VGG-19下載

因?yàn)槟P臀募?,github的項(xiàng)目中無法上傳這么大的文件,作者讓我們自己下。

我把DPED的資源包統(tǒng)一打包了,也可以從我的云盤下載, 放到項(xiàng)目的vgg_pretrained目錄下。下圖是資源包的目錄

資源包地址? 提取碼:TUAN。

項(xiàng)目運(yùn)行

項(xiàng)目需要的環(huán)境我們都裝好了,我們跳過訓(xùn)練的部分,測試model的方法官方給出了命令。

準(zhǔn)備圖片素材

我準(zhǔn)備了幾張圖,就不全展示了,展示其中的一張。

按照項(xiàng)目的要求,需要放在對應(yīng)的目錄下。

測試效果

執(zhí)行命令

python test_model.py model=iphone_orig test_subset=full resolution=orig use_gpu=true

執(zhí)行過程

(tensorflow) C:\Users\yi\PycharmProjects\DPED>python test_model.py model=iphone_orig test_subset=full resolution=orig use_gpu=true
2021-11-27 23:42:57.922965: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-11-27 23:43:00.532645: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to
use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-11-27 23:43:00.535946: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-11-27 23:43:00.559967: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1070 computeCapability: 6.1
coreClock: 1.759GHz coreCount: 15 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 238.66GiB/s
2021-11-27 23:43:00.560121: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-11-27 23:43:00.577706: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-11-27 23:43:00.577812: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-11-27 23:43:00.588560: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-11-27 23:43:00.591950: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-11-27 23:43:00.614412: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-11-27 23:43:00.624267: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-11-27 23:43:00.626309: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-11-27 23:43:00.626481: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-11-27 23:43:01.112598: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-11-27 23:43:01.112756: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0
2021-11-27 23:43:01.113098: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N
2021-11-27 23:43:01.113463: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6720 MB
 memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)
2021-11-27 23:43:01.114296: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
WARNING:tensorflow:From C:\Users\yi\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\compat\v2_compat.py:96: disable_resource_variables (from tensorflow.p
ython.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
2021-11-27 23:43:01.478512: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-11-27 23:43:01.479339: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1070 computeCapability: 6.1
coreClock: 1.759GHz coreCount: 15 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 238.66GiB/s
2021-11-27 23:43:01.479747: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-11-27 23:43:01.480519: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-11-27 23:43:01.480927: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-11-27 23:43:01.481155: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-11-27 23:43:01.481568: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-11-27 23:43:01.481823: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-11-27 23:43:01.482188: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-11-27 23:43:01.482416: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-11-27 23:43:01.482638: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-11-27 23:43:01.482959: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1070 computeCapability: 6.1
coreClock: 1.759GHz coreCount: 15 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 238.66GiB/s
2021-11-27 23:43:01.483077: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-11-27 23:43:01.483254: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-11-27 23:43:01.483426: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-11-27 23:43:01.483638: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-11-27 23:43:01.483817: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-11-27 23:43:01.484052: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-11-27 23:43:01.484250: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-11-27 23:43:01.484433: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-11-27 23:43:01.484662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-11-27 23:43:01.484841: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-11-27 23:43:01.484984: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0
2021-11-27 23:43:01.485152: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N
2021-11-27 23:43:01.485395: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6720 MB
 memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1)
2021-11-27 23:43:01.485565: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-11-27 23:43:01.518135: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:196] None of the MLIR optimization passes are enabled (registered 0 passes)
Testing original iphone model, processing image 3.jpg
2021-11-27 23:43:01.863678: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-11-27 23:43:02.517063: I tensorflow/core/platform/windows/subprocess.cc:308] SubProcess ended with return code: 0
 
2021-11-27 23:43:02.632790: I tensorflow/core/platform/windows/subprocess.cc:308] SubProcess ended with return code: 0
 
2021-11-27 23:43:03.210892: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-11-27 23:43:03.509052: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
Lossy conversion from float32 to uint8. Range [-0.06221151351928711, 1.0705437660217285]. Convert image to uint8 prior to saving to suppress this warning.
Lossy conversion from float32 to uint8. Range [-0.06221151351928711, 1.0705437660217285]. Convert image to uint8 prior to saving to suppress this warning.
Testing original iphone model, processing image 4.jpg
Lossy conversion from float32 to uint8. Range [-0.05176264047622681, 1.0500218868255615]. Convert image to uint8 prior to saving to suppress this warning.
Lossy conversion from float32 to uint8. Range [-0.05176264047622681, 1.0500218868255615]. Convert image to uint8 prior to saving to suppress this warning.
Testing original iphone model, processing image 5.jpg
Lossy conversion from float32 to uint8. Range [-0.03344374895095825, 1.0417983531951904]. Convert image to uint8 prior to saving to suppress this warning.
Lossy conversion from float32 to uint8. Range [-0.03344374895095825, 1.0417983531951904]. Convert image to uint8 prior to saving to suppress this warning.
Testing original iphone model, processing image 6.jpg
Lossy conversion from float32 to uint8. Range [-0.03614246845245361, 1.063475251197815]. Convert image to uint8 prior to saving to suppress this warning.
Lossy conversion from float32 to uint8. Range [-0.03614246845245361, 1.063475251197815]. Convert image to uint8 prior to saving to suppress this warning.

項(xiàng)目會生成前后對比圖以及最終結(jié)果圖。

前后效果圖,左邊為原始圖,右邊為對比圖。

結(jié)果圖如下

可以明顯的看出,新圖已經(jīng)明亮了許多,色彩也變的比較鮮明了,效果還是很不錯(cuò)的。?

到此這篇關(guān)于Python DPED機(jī)器學(xué)習(xí)之實(shí)現(xiàn)照片美化的文章就介紹到這了,更多相關(guān)照片美化內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • python 讀取文本文件的行數(shù)據(jù),文件.splitlines()的方法

    python 讀取文本文件的行數(shù)據(jù),文件.splitlines()的方法

    今天小編就為大家分享一篇python 讀取文本文件的行數(shù)據(jù),文件.splitlines()的方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-07-07
  • 詳解用 python-docx 創(chuàng)建浮動(dòng)圖片

    詳解用 python-docx 創(chuàng)建浮動(dòng)圖片

    這篇文章主要介紹了詳解用 python-docx 創(chuàng)建浮動(dòng)圖片,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • python深度學(xué)習(xí)借助多標(biāo)簽分類器進(jìn)行對抗訓(xùn)練

    python深度學(xué)習(xí)借助多標(biāo)簽分類器進(jìn)行對抗訓(xùn)練

    這篇文章主要為大家介紹了python深度學(xué)習(xí)中如何借助多標(biāo)簽分類器進(jìn)行對抗訓(xùn)練,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2022-01-01
  • 一文帶你玩轉(zhuǎn)Python屬性和方法

    一文帶你玩轉(zhuǎn)Python屬性和方法

    Python是一種簡潔而強(qiáng)大的編程語言,其支持面向?qū)ο蟮木幊谭妒剑疚膶娜腴T到精通介紹Python中的屬性和方法,幫助大家深入了解這些重要的概念,并學(xué)會如何在實(shí)際開發(fā)中靈活應(yīng)用它們
    2023-07-07
  • Anaconda第三方庫下載慢的解決方法

    Anaconda第三方庫下載慢的解決方法

    本文主要介紹了Anaconda第三方庫下載慢的解決方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-07-07
  • Python 中的集合和字典

    Python 中的集合和字典

    這篇文章主要介紹了Python 集合中的字典,下面文章關(guān)于python中的集合和字典的相關(guān)內(nèi)容敘述詳細(xì),具有一定的參考價(jià)值,需要的小伙伴可以參考一下,希望對你的學(xué)習(xí)有所幫助
    2022-03-03
  • Python如何繪制日歷圖和熱力圖

    Python如何繪制日歷圖和熱力圖

    這篇文章主要介紹了Python如何繪制日歷圖和熱力圖,幫助大家更好的理解和學(xué)習(xí)Python,感興趣的朋友可以了解下
    2020-08-08
  • 對pandas處理json數(shù)據(jù)的方法詳解

    對pandas處理json數(shù)據(jù)的方法詳解

    今天小編就為大家分享一篇對pandas處理json數(shù)據(jù)的方法詳解,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-02-02
  • Python?jieba庫的安裝詳細(xì)圖文教程

    Python?jieba庫的安裝詳細(xì)圖文教程

    jieba庫的作用主要用于中文分詞,是一種不錯(cuò)的中文分詞組件,下面這篇文章主要給大家介紹了關(guān)于Python?jieba庫安裝的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-03-03
  • Python獲取好友地區(qū)分布及好友性別分布情況代碼詳解

    Python獲取好友地區(qū)分布及好友性別分布情況代碼詳解

    利用Python + wxpy 可以快速的查詢自己好友的地區(qū)分布情況,以及好友的性別分布數(shù)量。還可以批量下載好友的頭像,拼接成大圖。感興趣的朋友跟隨小編一起看看吧
    2019-07-07

最新評論

宜君县| 鄂温| 宁晋县| 太白县| 漳平市| 隆回县| 蓬莱市| 临澧县| 寿阳县| 滁州市| 房产| 高淳县| 沅江市| 韩城市| 宜宾市| 渭南市| 黔西| 三原县| 红原县| 固镇县| 富平县| 西乡县| 凤山市| 汉源县| 遵化市| 常州市| 铁岭市| 枣强县| 麻栗坡县| 广德县| 清河县| 揭西县| 郁南县| 曲沃县| 西华县| 延寿县| 大理市| 延长县| 莱西市| 拉孜县| 师宗县|