-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcifar.py
39 lines (34 loc) · 1018 Bytes
/
cifar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import tensorflow as tf
import numpy as np
from CIFAR.cifarDataLoader import maybe_download_and_extract,load_class_names,load_training_data
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
class model():
def __init__():
pass
class catsanddogs():
def __init__(self):
maybe_download_and_extract()
imgs,cls = load_training_data()
cats = []
dogs = []
self.data=[]
for i in range(0,len(cls)):
if cls[i] == 3:
cats.append(imgs[i])
self.data.append(imgs[i])
elif cls[i] == 5:
dogs.append(imgs[i])
self.data.append(imgs[i])
else :
pass
def getdata(self):
return self.data
def main():
maybe_download_and_extract()
data = catsanddogs()
candd = data.getdata()
print('The number of samples are', len(candd))
if __name__ == "__main__":
# execute only if run as a script
main()