Skip to content

Commit 8f20b19

Browse files
committed
update
1 parent b164b29 commit 8f20b19

File tree

2 files changed

+66
-6
lines changed

2 files changed

+66
-6
lines changed

Diff for: readme/Arxiv_papers_README.md

+17
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,25 @@ You would not need the COCO Annotations if you did not need Class Labels or in t
2727
| |-- image_info_test-dev2017.json
2828
2929
```
30+
> TRAIN CenterNet on your Custom Data as mentioned below in the -- CenterNet/readme/DEVELOP.md
3031
32+
- CenterNet/readme/DEVELOP.md -- https://github.com/xingyizhou/CenterNet/blob/4c50fd3a46bdf63dbf2082c5cbb3458d39579e6c/readme/DEVELOP.md?plain=1#L14
3133

34+
35+
```
36+
## New dataset
37+
Basically there are three steps:
38+
39+
- Convert the dataset annotation to [COCO format](http://cocodataset.org/#format-data). Please refer to [src/tools/convert_kitti_to_coco.py](../src/tools/convert_kitti_to_coco.py) for an example to convert kitti format to coco format.
40+
- Create a dataset intilization file in `src/lib/datasets/dataset`. In most cases you can just copy `src/lib/datasets/dataset/coco.py` to your dataset name and change the category information, and annotation path.
41+
- Import your dataset at `src/lib/datasets/dataset_factory`.
42+
43+
## New task
44+
45+
You will need to add files to `src/lib/datasets/sample/`, `src/lib/datasets/trains/`, and `src/lib/datasets/detectors/`, which specify the data generation during training, the training targets, and the testing, respectively.
46+
47+
## New architecture
48+
```
3249
#
3350

3451
> How do we get the GROUND TRUTH data to benchmark against ?

Diff for: src/basic_foo/keras_mnist/src/test_1.py

+49-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
from tensorflow import keras
88
from tensorflow.keras.layers import Dense
99
#from tensorflow.examples.tutorials.mnist import input_data
10+
from tensorflow.keras.datasets import mnist
11+
import matplotlib.pyplot as plt
12+
1013

1114
def get_init_config():
1215
"""
@@ -60,6 +63,32 @@ def get_mnist():
6063
"""
6164
mnist = tf.keras.datasets.mnist # print("--type(mnist---",type(mnist)) #<class 'module'>
6265
(x_train, y_train),(x_test, y_test) = mnist.load_data()
66+
# count the number of unique train labels
67+
unique, counts = np.unique(y_train, return_counts=True)
68+
print("--type(unique)--",type(unique)) # ndArray
69+
print("unique TRAIN DATA labels: ", dict(zip(unique, counts)))
70+
71+
unique, counts = np.unique(y_test, return_counts=True)
72+
print("unique TEST DATA labels: ", dict(zip(unique, counts)))
73+
#
74+
print("--shape of the x_train and y_train--->",x_train.shape[0],y_train.shape[0])
75+
# sample 25 mnist digits from train dataset
76+
indexes = np.random.randint(0, x_train.shape[0], size=25)
77+
images = x_train[indexes]
78+
print("--type(images)--",type(images)) # ndArray
79+
labels = y_train[indexes]
80+
print("--type(labels)--",type(labels)) # ndArray
81+
# plot the 25 mnist digits
82+
# plt.figure(figsize=(5,5))
83+
# for i in range(len(indexes)):
84+
# plt.subplot(5, 5, i + 1)
85+
# image = images[i]
86+
# plt.imshow(image, cmap='gray')
87+
# plt.axis('off')
88+
# plt.savefig("mnist-samples.png")
89+
# plt.show()
90+
# plt.close('all')
91+
6392
#print("---type(x_train---",type(x_train)) #--type(x_train--- <class 'numpy.ndarray'>
6493
print("---type(x_test---np.shape(x_test)-",np.shape(x_test)) #(10000, 28, 28)
6594
print("---type(x_test---np.shape(x_train)-",np.shape(x_train)) #(60000, 28, 28)
@@ -82,9 +111,9 @@ def get_mnist():
82111
print("--type(img_1)-",type(img_1))
83112
print("--np.shape(img_1)---",np.shape(img_1))
84113

85-
cv2.imshow('First sample', x_train[0])
86-
cv2.waitKey(5000)
87-
cv2.destroyWindow('First sample')
114+
# cv2.imshow('First sample', x_train[0])
115+
# cv2.waitKey(5000)
116+
# cv2.destroyWindow('First sample')
88117
# cv2.imshow("image", img_1)
89118
# cv2.waitKey()
90119

@@ -97,12 +126,11 @@ def get_mnist():
97126
# y_train = tf.keras.utils.to_categorical(y_train, num_classes)
98127
# y_test = tf.keras.utils.to_categorical(y_test, num_classes)
99128

100-
101129

102130
# mnist_data = input_data.read_data_sets('MNIST_data', one_hot=True)
103131
# print("--type(mnist---",type(mnist_data))
104132

105-
#return #mnist_data , input_shape
133+
return x_train, y_train,x_test, y_test #mnist_data , input_shape
106134

107135
def create_model_seq(mnist_data):
108136
"""
@@ -133,10 +161,25 @@ def get_summary(model):
133161
tf.keras.utils.plot_model(model, to_file="model_2.png", show_shapes=True)
134162

135163

164+
def net_1(x_train, y_train,x_test, y_test):
165+
"""
166+
"""
167+
from tensorflow.keras.models import Sequential
168+
from tensorflow.keras.layers import Dense, Activation, Dropout
169+
from tensorflow.keras.utils import to_categorical, plot_model
170+
# compute the number of labels
171+
num_labels = len(np.unique(y_train))
172+
print("----num_labels---",num_labels)
173+
# OneHot Encoding
174+
y_train = to_categorical(y_train)
175+
y_test = to_categorical(y_test)
176+
177+
136178
if __name__ == "__main__":
137179
#
138180
get_init_config()
139-
get_mnist() #mnist_data =
181+
x_train, y_train,x_test, y_test = get_mnist() #mnist_data =
182+
net_1(x_train, y_train,x_test, y_test)
140183
# model = create_model_seq(mnist_data) #input_shape = (None, 32, 32, 3)
141184
# model.build() #model.build(input_shape)
142185
# get_summary(model)

0 commit comments

Comments
 (0)