modified code for weight-on-hog-descriptor image generation