Python folders like data visualization
- Import Matplotlib.pyplot as Plt
- Import Matplotlib.image as Mpimg
- Import NumPy as NP
- Import Urllib2
- Import Urllib
- Import OS
- Import Shutil
- Subdir= "/7"
- Homedir = OS.GETCWD () + subdir
- # "/home/haoyou/dev/last_caffe_with_stn/myprojects/spn-mnistcluttered/mnist-cluttered/" +subdir
- Import OS
- def walk_dir (dir,fileinfo,topdown=true):
- For root, dirs, files in Os.walk (dir, topdown):
- For name in Files:
- Print (Os.path.join (name))
- Fileinfo.write (Os.path.join (root,name) + ' \ n ')
- For name in dirs:
- Print (Os.path.join (name))
- Fileinfo.write (' + os.path.join (root,name) + ' \ n ')
- FileInfo = open (homedir+ '/list.txt ', ' W ')
- Walk_dir (Homedir,fileinfo)
- f = open (homedir+ "/list.txt", "R")
- While True:
- For I in Range (1,101):
- line = F.readline ()
- If line:
- Line=line.strip ()
- Plt.subplot (10,10,i)
- Lena = Mpimg.imread (line)
- Plt.imshow (lena,cmap= ' Gray ')
- Plt.axis (' off ')
- Else
- Break
- Plt.show ()
- # for line in F:
- # #pass # do something here
- # Line=line.strip ()
- # Print (line)
- # Lena = Mpimg.imread (line)
- F.close ()
Python folders like data visualization