From a47874a7e8ee2f0b22b59132e8e807468233dff0 Mon Sep 17 00:00:00 2001 From: Joseph Redmon Date: Mon, 13 Jul 2015 23:25:08 -0700 Subject: [PATCH] nochange option in crop --- Makefile | 4 ++-- src/crop_layer.c | 4 ++++ src/crop_layer_kernels.cu | 4 ++++ src/layer.h | 1 + src/parser.c | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 32ff4c0a..1b422777 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -GPU=0 -OPENCV=0 +GPU=1 +OPENCV=1 DEBUG=0 ARCH= -arch=sm_52 diff --git a/src/crop_layer.c b/src/crop_layer.c index 13190219..d9950d6c 100644 --- a/src/crop_layer.c +++ b/src/crop_layer.c @@ -48,6 +48,10 @@ void forward_crop_layer(const crop_layer l, network_state state) int dw = rand()%(l.w - l.crop_width + 1); float scale = 2; float trans = -1; + if(l.noadjust){ + scale = 1; + trans = 0; + } if(!state.train){ flip = 0; dh = (l.h - l.crop_height)/2; diff --git a/src/crop_layer_kernels.cu b/src/crop_layer_kernels.cu index d60cc0a7..9df915cc 100644 --- a/src/crop_layer_kernels.cu +++ b/src/crop_layer_kernels.cu @@ -181,6 +181,10 @@ extern "C" void forward_crop_layer_gpu(crop_layer layer, network_state state) float scale = 2; float translate = -1; + if(layer.noadjust){ + scale = 1; + translate = 0; + } int size = layer.batch * layer.w * layer.h; diff --git a/src/layer.h b/src/layer.h index c3191837..29abec05 100644 --- a/src/layer.h +++ b/src/layer.h @@ -49,6 +49,7 @@ typedef struct { int objectness; int does_cost; int joint; + int noadjust; float alpha; float beta; diff --git a/src/parser.c b/src/parser.c index 893111e3..96707152 100644 --- a/src/parser.c +++ b/src/parser.c @@ -196,7 +196,10 @@ crop_layer parse_crop(list *options, size_params params) batch=params.batch; if(!(h && w && c)) error("Layer before crop layer must output image."); + int noadjust = option_find_int_quiet(options, "noadjust",0); + crop_layer l = make_crop_layer(batch,h,w,c,crop_height,crop_width,flip, angle, saturation, exposure); + l.noadjust = noadjust; return l; }