Training neural Networks with Very Little Data--A Draft radial transformation

Source: Internet
Author: User

A recent article on data enhancement is more interesting: here is the core code implementation and implementation details, which can be accessed by itself:
Training neural Networks with Very Little data–a
The general meaning of the article is to transform the Cartesian coordinate system into the image in polar coordinate system through some transformation, which is directly given by the following formula:

The transformation is simple, the formula is also written clearly, according to the formula to implement the code:
GitHub
Https://github.com/zhly0/radial-transform

From skimage import data from skimage import IO import numpy as NP import math import Matplotlib.pyplot as Plt def To_gra
    Y (img): w, h,_ = img.shape ret = Np.empty (W, h), dtype=np.uint8) RETF = Np.empty ((w, h), dtype=np.float) IMGF = Img.astype (float) retf[:,:] = (imgf[:,:, 1] + imgf[:,:, 2] + imgf[:,:, 0])/3) ret = Retf.astype (Np.uin
    T8 return ret def radia_transform (img,w,h): shape = Im.shape new_im = Np.zeros (shape) print (SHAPE) Print (len) print (' W ', W) print (' H ', h) width = shape[1] height = shape[0] Lens = Len (shape) F or I in range (0,width): Xita = 2*3.14159*i/width to A in range (0,height): x = (int) (Math.floo R (A * Math.Cos (Xita))) y = (int) (Math.floor (A * Math.sin (Xita))) new_y = (int) (h+x) NE  w_x = (int) (w+y) #print (h.dtype) if new_x>=0 and New_x<width:if new_y>=0
  and New_y 

and the corresponding transformations:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.