16 crop_layer make_crop_layer(
int batch,
int h,
int w,
int c,
int crop_height,
int crop_width,
int flip,
float angle,
float saturation,
float exposure)
18 fprintf(stderr,
"Crop Layer: %d x %d -> %d x %d x %d image\n", h,w,crop_height,crop_width,c);
25 l.
scale = (float)crop_height / h;
31 l.
out_h = crop_height;
43 l.rand_gpu = cuda_make_array(0, l.
batch*8);
61 cuda_free(l->output_gpu);
72 int flip = (l.
flip && rand()%2);
73 int dh = rand()%(l.
h - l.
out_h + 1);
74 int dw = rand()%(l.
w - l.
out_w + 1);
86 for(b = 0; b < l.
batch; ++b){
87 for(c = 0; c < l.
c; ++c){
88 for(i = 0; i < l.
out_h; ++i){
89 for(j = 0; j < l.
out_w; ++j){
91 col = l.
w - dw - j - 1;
96 index = col+l.
w*(row+l.
h*(c + l.
c*b));
image get_crop_image(crop_layer l)
void forward_crop_layer_gpu(crop_layer layer, network net)
void(* forward_gpu)(struct layer, struct network)
void(* backward_gpu)(struct layer, struct network)
void forward_crop_layer(const crop_layer l, network net)
void(* forward)(struct layer, struct network)
image float_to_image(int w, int h, int c, float *data)
void(* backward)(struct layer, struct network)
void resize_crop_layer(layer *l, int w, int h)
void backward_crop_layer_gpu(const crop_layer l, network net)
void backward_crop_layer(const crop_layer l, network net)
crop_layer make_crop_layer(int batch, int h, int w, int c, int crop_height, int crop_width, int flip, float angle, float saturation, float exposure)