From 38bd6ae6ba24fc8c14fd61d1238ae94a983434b3 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Mon, 20 Jul 2015 23:16:26 +0000
Subject: [PATCH] Better partial function
---
src/crop_layer_kernels.cu | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/crop_layer_kernels.cu b/src/crop_layer_kernels.cu
index 98d1ef4..9df915c 100644
--- a/src/crop_layer_kernels.cu
+++ b/src/crop_layer_kernels.cu
@@ -114,9 +114,9 @@
size_t offset = id * h * w * 3;
image += offset;
- float r = image[x + w*(y + h*2)];
+ float r = image[x + w*(y + h*0)];
float g = image[x + w*(y + h*1)];
- float b = image[x + w*(y + h*0)];
+ float b = image[x + w*(y + h*2)];
float3 rgb = make_float3(r,g,b);
if(train){
float3 hsv = rgb_to_hsv_kernel(rgb);
@@ -124,9 +124,9 @@
hsv.z *= exposure;
rgb = hsv_to_rgb_kernel(hsv);
}
- image[x + w*(y + h*2)] = rgb.x*scale + translate;
+ image[x + w*(y + h*0)] = rgb.x*scale + translate;
image[x + w*(y + h*1)] = rgb.y*scale + translate;
- image[x + w*(y + h*0)] = rgb.z*scale + translate;
+ image[x + w*(y + h*2)] = rgb.z*scale + translate;
}
__global__ void forward_crop_layer_kernel(float *input, float *rand, int size, int c, int h, int w, int crop_height, int crop_width, int train, int flip, float angle, float *output)
@@ -181,6 +181,10 @@
float scale = 2;
float translate = -1;
+ if(layer.noadjust){
+ scale = 1;
+ translate = 0;
+ }
int size = layer.batch * layer.w * layer.h;
--
Gitblit v1.10.0