darknet中cfg文件中的
height = 224
width = 224
通过源码中以下函数实现最终的图片剪裁
void train_classifier( )
{
args.size = net.w;//将cfg文件中指定图片宽度信息传递给size变量
args.type = CLASSIFICATION_DATA;
load_thread = load_data(args);
}
void load_thread( )
{
else if (a.type == CLASSIFICATION_DATA){
*a.d = load_data_augment( );
}
}
data load_data_augment( )
{
d.X = load_image_augment_paths();
}
matrix load_image_augment_paths()
{
image im = load_image_color(path[i],0,0);//w=0, h=0 并未在该函数剪裁图片
image crop = random_augment_image();
}
image random_augment_image()//随机增强图像
{
image crop = rotate_crop_image(im, rad, scale, size, size, dx, dy, aspect);//通过size实现将图片剪裁至指定大小
}