FlyAI contest is a platform for data on the depth of learning, there are many, many top projects can participate in the competition, but there are a lot of bonuses. (The writing more casual, do not pay attention too much of the format)
The purpose of writing this article is to make as I did the first time students to participate in the competition face competition not know where to start given some methods.
This time to participate in the contest is a picture Kam Wong contest, then tell us about the function of each module is given in FlyAI how and how to write code in each module.
In the sample code FlyAI given there are four modules, the first major module is main.py, we can build our network model in this module, the second module is processor.py module, in this module where we can deal with our data.
In the processor module, the data set is pre-
input_x DEF (Self, image_path): path = check_download (image_path, Data_Path) Image cv2.imread = (path) Image cv2.resize = (Image, (224, 224), interpolation = cv2.INTER_CUBIC) x_data numpy.array = ( Image) x_data = x_data.astype (numpy.float32) x_data = numpy.multiply (x_data, 1.0 / 255.0) return x_data '' ' parameter as a csv input data y, the method is dataset.next_train_batch () and dataset.next_validation_batch () multiple calls. The method fields in app.yaml output: -> columns: corresponding to '' ' DEF input_y (Self, label): one_hot_label numpy.zeros = ([. 5]) all-0 matrix ## generates one_hot_label [label] = 1 # opposite respective tag positions # return one_hot_label
After preprocessing of the data, we can build the network model, here we give an example
= a Dataset DataSet (= args.EPOCHS epochs, BATCH = args.BATCH) Model = the Model (DataSet) '' ' to achieve their Network mechanism ' '' sqeue the Sequential = () # convolution first layer, convolution 32 nuclear, 5x5 size, convolution mode SAME, RELU activation function, the magnitude of the input tensor sqeue.add (Conv2D (= Filters 32, kernel_size = (. 5,. 5), padding = 'Same,', activation = 'RELU', input_shape = (224, 224,. 3))) sqeue.add (Conv2D (= Filters 32, kernel_size = (. 5,. 5), padding = 'Same,', Activation = 'RELU')) # pooled layer, the size of the pool of the nuclear 2x2 sqeue.add (MaxPool2D (pool_size = (2, 2))) sqeue.add (Dropout (0.25)) sqeue.add (Conv2D (= Filters 64, kernel_size = (. 3,. 3), padding = 'Same,', Activation = 'RELU')) sqeue.add (Conv2D (= Filters 64, kernel_size = (. 3,. 3), padding = 'Same,',Activation = 'resumption')) sqeue.add (MaxPool2D (pool_size = (2, 2), Strides = (2, 2))) sqeue.add (Dropout (0.25)) # fully connected layers, unfolding operation, sqeue.add (The Flatten ()) # Add and the number of hidden layer neuron activation function sqeue.add (the Dense (256, activation = 'RELU')) sqeue.add (Dropout (0.25)) # output layer sqeue.add (Dense (5, activation = 'softmax') ) # overall output of the model information sqeue.summary () sqeue.compile (Loss = 'categorical_crossentropy', Optimizer = 'ADAM', metrics = [ 'Accuracy']) '' '