Can we use biger stride than 1 in Conv2, Convn, Imfilter ?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
1 개 추천
Hi, I want to use conv2, convn, or Imfilter to filter an image, but i want to stride more than 1, So that to have a reduced output filtered image. How can i do that with builtin matlab functions.
채택된 답변
Image Analyst
2015년 12월 10일
If you don't want to slide over one pixel, then you can either do the whole thing and subsample the result,
smallResults = fullSizeResult(1:4:end, 1:8:end);
Adjust the step value to whatever you want the jump to be.
Alternatively you can use blockproc(), and I'm attaching some demos for that. blockproc() allows you to scan along your image in "jumps" of a specified step (distance) and process only those window locations.
댓글 수: 7
Naveed Khan
2015년 12월 10일
편집: Naveed Khan
2015년 12월 10일
Thank you for your reply. As far i understood this code, this does not have overlap, each time it consider only new area without overlap on previous section. I want something similar like the kernels in conv builtin function. but instead of having 1 movement, i want 2 or 3 , i mean a stride of 2 or 3
What does that mean? What is movement and stride? You basically set up a window and then it moves over one pixel at a time for conv2() where as blockproc() can move in "jumps" of 2 or 3 pixels. Of course if it moves 2 or 3 pixels, there may or may not be overlap depending on the inputs to blockproc(). You can have blockproc() move by distances less than the window size if you want, though that is the default. For example if your window size is 11, it will move in jumps of 11, unless you set an arugment to tell it to move in jumps of 5 or 7 or something else.
Please clarify.
Naveed Khan
2015년 12월 10일
편집: Image Analyst
2015년 12월 10일
Thanks again, i mean to say that, for example if i have a 7x7 image, and a 3x3 kernel. the coordinates for first kernel region to be convolved will be from (1:3,1:3) and for the second it will be from (1:3,2:4) and for third it will be (1:3,3:5) and so on. each time the kernel leave one column and move to the next. This is what I call a stride of 1. (Also called by Caffe community in deep learning). What if I want to take a bigger stride. e.g. (1:3,1:3), then (1:3,3:5), then (1:3,5:7) and so on. This means I have a stride of 2. Can I change the default step of 1 in conv2, convn, or imfilter function.
The caffe community have it in convolutional neural networks. I want to try something similar in matlab, but Matlab builtin functions doesnt have any option of changing or using a specific stride value.
Just use blockproc() with the 'BorderSize' option.
Jihang Wang
2018년 8월 15일
편집: Jihang Wang
2018년 8월 15일
@Image Analyst Change border size only influence the overlapping but the stride is still 1, right? I am struggling with this issue, please advise. Thanks!
No, not right. You can specify both the "jump" distance and the overlap independently. See my attached demo.
Matti Kaupenjohann
2021년 4월 12일
편집: Matti Kaupenjohann
2021년 4월 12일
I found this conversation -- while I was looking for a faster implementation for my code -- and was using blockproc before, so I timed it again, but since it was very slow I decided to create my structure by myself and used mexfun. Still not impressing 0.356 seconds for my code but much faster than the 1.6 seconds with blockproc implementation.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
