自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 资源 (1)
  • 收藏
  • 关注

原创 动态规划中等题

在排序数组中查找元素的第一个和最后一个位置class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: if not nums: return [-1,-1] first_index = self.firstK(nums,target) last_index= self.lastK(nums,target) .

2020-07-01 10:39:52 92

原创 搜索算法(快排,堆排)

数组中的第K个最大元素# class Solution:# def findKthLargest(self, nums: List[int], k: int) -> int:# if len(nums)<k:# return# low = 0# high = len(nums) - 1# self.quicksort(nums,low,high,k)# return.

2020-06-29 21:32:31 200

原创 算法堆

堆,父节点值要大于子节点值,所以跟节点是最大或最小的初建堆比较,父节点与子节点的交换,n/2的元素会交换k次,很明显时间复杂度O(n)重建堆每次弹出元素,要重新排列堆,需要比较logn,所以是O(nlogn)前 K 个高频元素思路一:利用哈希表存储之后排序,获取前k个,时间复杂度大于O(nlogn)思路二:堆,先哈希表O(n),构建堆更新,O(nlogk),堆适用于,前多少个这种,可以不用管之后的数据,尤其在大数据的情况下。class Solution: def topKFre

2020-06-28 23:37:47 191

原创 算法排序中等之快速排序

快速排序总结:1、时间复杂度O(nlogn),一般选用一个元素找寻其位置,速度快的原因是元素的交换扩大到了整个范围,而冒泡排序只能相邻之间交换,如果快速排序每次交换都是相邻交换的话,时间复杂度也就退化到了O(n^2)2、快速排序适合比较大的数组,比较小的数组用插入排序,因为快速排序不稳定,n比较小时,logn与n相差不大3、对于重复度比较高时,可以用快速排序的三分来做,因为重复度比较高,快速排序交换的都是无用的交换,三分法能将O(nlogn)降为O(n),如下题颜色分类class Soluti

2020-06-28 21:22:55 91

原创 算法其他(简单)

打乱数组class Solution: def __init__(self, nums: List[int]): self.array = nums self.original = nums.copy() def reset(self) -> List[int]: """ Resets the array to its original configuration and return it. ".

2020-06-23 20:37:31 77

原创 算法动态规划(简单)

爬梯子:斐波那契数列,没什么好说的买卖股票的最佳时机逻辑f(i)为以i为卖出点的最大利润,g(i)为i点的价格g(i-1) - g(i) > f(i-1),f(i) = 0g(i-1) - g(i) < f(i - 1),f(i) = f(i-1) + g(i) - g(i-1)class Solution: def maxProfit(self, prices: List[int]) -> int: if len(prices) < 2:

2020-06-23 14:43:45 102 1

原创 算法排序和搜索篇(简单)

合并两个有序数组思路一:合并之后再排序,时间O((m+n)log(m+n))思路二:双指针class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ p1 = m - 1.

2020-06-22 16:05:10 116

原创 算法(字符串篇简单1)

反转字符串和反转数组一样,尾部与头部交换字符串中的第一个唯一字符第一个不重复的字符,不重复用哈希表来判断实现 strStr()判断某字符串是否含有子字符串思路一:暴力法,先匹配第一个字符,不一样的话往后移,如果一样就内部匹配,匹配不成功就回溯,时间最坏O(N(N-L)),空间O(1)思路二:KMP算法 时间O(N+L),回溯不太好,利用部分匹配表class Solution: def strStr(self, haystack: str, needle: str) -..

2020-06-22 15:08:42 75

原创 算法(数组篇简单篇2思路)

存在重复元素判断是否存在重复元素思路一,死做,时间O(n^2),空间O(1)思路二,快排,再两两比较,时间O(nlogn),空间O(1)思路三,哈希表,时间O(n),空间O(n)只出现一次的数字除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。思路一,死做,加两层循环思路二:哈希表,字典思路三:异或运算,时间O(n),空间O(1)买卖股票的最佳时机 II思路一:计算得到每个峰谷和峰顶,相减即是利润思路二:简单地一次遍历,如果nums[i] &..

2020-06-21 22:02:48 72

原创 算法(数组篇1)

旋转数组class Solution: def rotate(self, nums: List[int], k: int) -> None: """ Do not return anything, modify nums in-place instead. """ if len(nums) < k: k = k % len(nums) self.reverse(nums,0,le.

2020-06-21 20:21:24 75

原创 算法第十一题(攻克归并排序)

数组中的逆序对class Solution: def reversePairs(self, nums: List[int]) -> int: self.cnt = 0 def merge(nums, start, mid, end, temp): i, j = start, mid + 1 while i <= mid and j <= end: if nums[i.

2020-06-21 17:56:35 78

原创 算法第十题(二叉树)

二叉树的序列化与反序列化class Codec: def serialize(self, root): s = "" queue = [] queue.append(root) while queue: root = queue.pop(0) if root: s += str(root.val) queue.app.

2020-06-19 10:21:02 57

原创 算法第九题(二叉树)

验证二叉搜索树# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = None# class Solution:# def isValidBST(self, root: TreeNode) -> bool:# .

2020-06-17 14:52:07 92

原创 算法第八题(二叉树)

二叉树的最小深度class Solution: def minDepth(self, root: TreeNode) -> int: if root is None: return 0 if root.left is None and root.right is None: return 1 mindepth = float('inf') i.

2020-06-16 23:07:16 124

原创 算法第七题(589. N叉树的前序遍历)

class Node: def __init__(self, val=None, children=None): self.val = val self.children = children"""# class Solution:# def preorder(self, root: 'Node') -> List[int]:# if root is None:# return []#

2020-06-16 12:37:02 101

原创 算法第六题(14.最长公共前缀)

# class Solution:# def longestCommonPrefix(self, strs: List[str]) -> str:# if not strs: return ""# if len(strs)==1: return strs[0]# prefix = strs[0]# for i in range(1,len(strs)):# prefix = self.comp

2020-06-15 22:12:18 92

原创 算法第五题( 删除排序数组中的重复项26,11. 盛最多水的容器)

class Solution {public: int removeDuplicates(vector<int>& nums) { if(nums.empty()) return 0; if(nums.size()==1) return 1; int p = 0; for(int i=1;i<nums.size();i++){ if(nums[p]!=nums[i]){

2020-06-15 15:53:47 56

原创 算法第四题(移动零 leetcode283)

class Solution {public: void moveZeroes(vector<int>& nums) { int j=0; for(int i=0;i<nums.size();i++){ if(nums[i]!=0){ swap(nums[i],nums[j++]); } } } //设两个指针i,j,i指向非0,与j交换

2020-06-15 14:26:40 135

原创 算法第三题(LRU)

class DLinkedNode: def __init__(self, key=0, value=0): self.key = key self.value = value self.prev = None self.next = Noneclass LRUCache: def __init__(self, capacity: int): self.cache = dict() # 使

2020-06-15 00:47:31 128

原创 算法第二题(无重复字符的最长子串)

leetcode 3无重复字符的最长子串class Solution {public: int lengthOfLongestSubstring(string s) { if(s.empty()) return 0; if(s.length()==1) return 1; map<char,int> ma; int p1 = 0,p2 = 0; int maxLength = 0; w

2020-06-11 23:42:45 75

原创 算法第一题(爬梯子)

斐波那契数列leetcode 70(爬梯子)

2020-06-10 23:25:59 202

转载 vs封装

opencvdll生成caffe封装

2019-06-18 21:18:55 147

README.mdgfdgdf

# DnCNN-tensorflow [![AUR](https://img.shields.io/aur/license/yaourt.svg?style=plastic)](LICENSE) [![Docker Automated build](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg?style=plastic)](https://hub.docker.com/r/wenbodut/dncnn/) [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=plastic)](CONTRIBUTING.md) A tensorflow implement of the TIP2017 paper [Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising](http://www4.comp.polyu.edu.hk/~cslzhang/paper/DnCNN.pdf) ## Model Architecture ![graph](./img/model.png) ## Results ![compare](./img/compare.png) - BSD68 Average Result The average PSNR(dB) results of different methods on the BSD68 dataset. | Noise Level | BM3D | WNNM | EPLL | MLP | CSF |TNRD | DnCNN-S | DnCNN-B | DnCNN-tensorflow | |:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:| | 25 | 28.57 | 28.83 | 28.68 | 28.96 | 28.74 | 28.92 | **29.23** | **29.16** | **29.17** | - Set12 Average Result | Noise Level | DnCNN-S | DnCNN-tensorflow | |:-----------:|:-------:|:----------------:| | 25 | 30.44 | **30.38** | For the dataset and denoised images, please download [here](https://drive.google.com/open?id=16x8E7h0srYQliXbrO0pvX6zogfW1hN2P) ## Environment ### :whale: With docker (recommended): - Install docker support You may do it like this(ubuntu): ``` shell $ sudo apt-get install -y curl $ curl -sSL https://get.docker.com/ | sh $ sudo usermod -aG docker ${USER} ``` - Install nvidia-docker support(to make your GPU available to docker containers) You may do it like this(ubuntu): ```shell $ wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb $ sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb ``` - Pull dncnn image and start a container ```shell $ docker pull wenbodut/dncnn $ ./rundocker.sh ``` Then you could train the model. ### Without docker: You should make sure the following environment is contented ``` tensorflow == 1.4.1 numpy ``` ## One-Key-To-Denoise ``` $ ./oneKeyToDenoise.sh (need docker support) ``` Then you could find the noisy Set12 images and denoised images in test folder. Have fun! ## Train ``` $ python generate_patches.py $ python main.py (note: You can add command line arguments according to the source code, for example $ python main.py --batch_size 64 ) ``` For the provided model, it took about 4 hours in GTX 1080TI. Here is my training loss: **Note**: This loss figure isn't suitable for this trained model any more, but I don't want to update the figure :new_moon_with_face: ![loss](./img/loss.png) ## Test ``` $ python main.py --phase test ``` ## TODO - [x] Fix bug #13. (bug #13 fixed, thanks to @sdlpkxd) - [x] Clean source code. For instance, merge similar functions(e.g., 'load_images 'and 'load_image' in utils.py). - [x] Add one-key denoising, with the help of docker. - [x] Compare with original DnCNN. - [x] Replace tf.nn with tf.layer. - [ ] Replace PIL with OpenCV. - [ ] Try tf.dataset API to speed up training process. - [ ] Train a noise level blind model. ## Thanks for their contributions - @lizhiyuanUSTC - @husqin - @sdlpkxd - and so on ...

2020-05-16

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除