├── .gitignore ├── Data ├── cars_photo.jpg ├── Train_Data │ ├── 0.jpg │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.jpg │ ├── 6.jpg │ ├── 7.jpg │ ├── 8.jpg │ └── 9.jpg └── Train_Label.text ├── requirements.txt ├── Sensor_Data ├── zed_process.py └── lidar_process.py ├── predict.py ├── get_data.py ├── train.py ├── README.md ├── get_model.py ├── ai.py └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.pyc 3 | .DS_Store 4 | 5 | Data/Checkpoints/ 6 | Data/Model/ 7 | -------------------------------------------------------------------------------- /Data/cars_photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/cars_photo.jpg -------------------------------------------------------------------------------- /Data/Train_Data/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/0.jpg -------------------------------------------------------------------------------- /Data/Train_Data/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/1.jpg -------------------------------------------------------------------------------- /Data/Train_Data/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/2.jpg -------------------------------------------------------------------------------- /Data/Train_Data/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/3.jpg -------------------------------------------------------------------------------- /Data/Train_Data/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/4.jpg -------------------------------------------------------------------------------- /Data/Train_Data/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/5.jpg -------------------------------------------------------------------------------- /Data/Train_Data/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/6.jpg -------------------------------------------------------------------------------- /Data/Train_Data/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/7.jpg -------------------------------------------------------------------------------- /Data/Train_Data/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/8.jpg -------------------------------------------------------------------------------- /Data/Train_Data/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardamavi/Jetson-RaceCar-AI/HEAD/Data/Train_Data/9.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | scipy 2 | numpy 3 | scikit-learn 4 | scikit-image 5 | tensorflow 6 | keras 7 | h5py 8 | -------------------------------------------------------------------------------- /Data/Train_Label.text: -------------------------------------------------------------------------------- 1 | 0.jpg 0.5 1.0 5.0 10.0 100.0 2 | 1.jpg 0.3 0.8 4.0 6.0 120.0 3 | 2.jpg 0.7 0.8 356.0 6.0 130.0 4 | 3.jpg 0.2 0.5 1.0 10.0 120.0 5 | 4.jpg 0.5 0.0 2.0 5.0 70.0 6 | 5.jpg 0.4 1.0 350.0 20.0 50.0 7 | 6.jpg 0.9 0.2 355.0 5.0 40.0 8 | 7.jpg 0.1 0.2 358.0 6.0 60.0 9 | 8.jpg 0.5 1.0 270.0 10.0 40.0 10 | 9.jpg 0.7 0.9 340.0 5.0 60.0 -------------------------------------------------------------------------------- /Sensor_Data/zed_process.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | import cv2 3 | 4 | # Getting capture: 5 | def get_capture(camera=1): # Camera 0 is jetson's embeded camera. 6 | cap = cv2.VideoCapture(camera) 7 | return cap 8 | 9 | # Release capture: 10 | def release_capture(capture): 11 | capture.release() 12 | 13 | # For 3D Picture: 14 | stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15) 15 | 16 | # Take a picture: 17 | def get_zed_data(capture): 18 | ret, img = capture.read() 19 | 20 | img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) 21 | 22 | img_left = img[0:376, 0:672] 23 | img_right = img[0:376, 672:1344] 24 | 25 | disparity = stereo.compute(img_left,img_right) 26 | 27 | return disparity 28 | -------------------------------------------------------------------------------- /predict.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | 3 | import sys 4 | import numpy as np 5 | from get_data import get_img 6 | from scipy.misc import imresize 7 | from keras.models import model_from_json 8 | 9 | def predict(model, img, lidar_data): 10 | Y = model.predict([img, lidar_data]) 11 | return Y 12 | 13 | def get_ready_model(): 14 | # Getting model: 15 | model_file = open('Data/Model/model.json', 'r') 16 | model = model_file.read() 17 | model_file.close() 18 | model = model_from_json(model) 19 | # Getting weights: 20 | model.load_weights("Data/Model/weights.h5") 21 | return model 22 | 23 | if __name__ == '__main__': 24 | img_dir = sys.argv[1] 25 | lidar_data = [sys.argv[2], sys.argv[3], sys.argv[4]] 26 | img = get_img(img_dir) 27 | model = get_ready_model() 28 | img = np.array(img).reshape(1, 500, 500, 1) 29 | lidar_data = np.array(lidar_data).reshape(1, 3) 30 | print(predict(model, img, lidar_data)) 31 | -------------------------------------------------------------------------------- /get_data.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | 3 | import numpy as np 4 | from scipy.misc import imread, imresize 5 | 6 | def get_img(data_path): 7 | # Getting image array from path: 8 | img = imread(data_path, mode='L') 9 | img = imresize(img, (500, 500, 1)) 10 | return img 11 | 12 | def get_data(): 13 | with open('Data/Train_Label.text', 'r') as file: 14 | all_file = file.read() 15 | X_1, X_2, Y = [], [], [] 16 | datasets = all_file.split('\n') 17 | for data in datasets: 18 | one_data = data.split(' ') 19 | img = get_img('Data/Train_Data/'+one_data[0]) 20 | X_1.append(img) 21 | X_2.append([float(one_data[3]), float(one_data[4]), float(one_data[5])]) 22 | Y.append([float(one_data[1]), float(one_data[2])]) 23 | X_1 = np.array(X_1).reshape(len(datasets), 500, 500, 1) 24 | X_2 = np.array(X_2).reshape(len(datasets), 3) 25 | Y = np.array(Y).reshape(len(datasets), 2) 26 | return X_1, X_2, Y 27 | -------------------------------------------------------------------------------- /Sensor_Data/lidar_process.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | from sweeppy import Sweep 3 | import itertools 4 | 5 | def get_lidar_data(): 6 | with Sweep('/dev/ttyUSB0') as lidar: 7 | while not lidar.get_motor_ready(): 8 | pass 9 | lidar.start_scanning() 10 | scans = lidar.get_scans() 11 | data = [] 12 | for scan in itertools.islice(lidar.get_scans(), 1): 13 | datas = scan[0] 14 | data.append([datas[0], datas[1], datas[2]]) 15 | lidar.stop_scanning() 16 | return data 17 | 18 | def start_lidar(): 19 | set_motor_speed(speed=5) 20 | set_sample_rate(rate=500) 21 | with Sweep('/dev/ttyUSB0') as lidar: 22 | lidar.start_scanning() 23 | 24 | def stop_lidar(): 25 | set_motor_speed(speed=0) 26 | set_sample_rate(rate=0) 27 | with Sweep('/dev/ttyUSB0') as lidar: 28 | lidar.stop_scanning() 29 | 30 | def set_motor_speed(speed=5): 31 | with Sweep('/dev/ttyUSB0') as lidar: 32 | if lidar.get_motor_speed() != speed: 33 | lidar.set_motor_speed(speed) 34 | 35 | def set_sample_rate(rate=500): 36 | with Sweep('/dev/ttyUSB0') as lidar: 37 | if lidar.get_sample_rate() != rate: 38 | lidar.set_sample_rate(rate) 39 | -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | 3 | import os 4 | import numpy as np 5 | from get_data import get_data 6 | from get_model import get_model, save_model 7 | from keras.callbacks import ModelCheckpoint, TensorBoard 8 | from keras.preprocessing.image import ImageDataGenerator 9 | 10 | def train_model(model, X_1, X_2, Y): 11 | 12 | batch_size = 1 13 | epochs = 10 14 | 15 | checkpoints = [] 16 | if not os.path.exists('Data/Checkpoints/'): 17 | os.makedirs('Data/Checkpoints/') 18 | checkpoints.append(ModelCheckpoint('Data/Checkpoints/best_weights.h5', monitor='val_loss', verbose=0, save_best_only=True, save_weights_only=True, mode='auto', period=1)) 19 | checkpoints.append(TensorBoard(log_dir='Data/Checkpoints/./logs', histogram_freq=0, write_graph=True, write_images=False, embeddings_freq=0, embeddings_layer_names=None, embeddings_metadata=None)) 20 | 21 | model.fit([X_1, X_2], Y, batch_size=batch_size, epochs=epochs, validation_data=([X_1, X_2], Y), shuffle=True, callbacks=checkpoints) 22 | 23 | return model 24 | 25 | def main(): 26 | X_1, X_2, Y = get_data() 27 | model = train_model(get_model(), X_1, X_2, Y) 28 | save_model(model) 29 | return model 30 | 31 | if __name__ == '__main__': 32 | main() 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jetson-RaceCar-AI 2 | Artificial intelligence for Jetson RaceCar
3 | Autonomous race car with deep learning. 4 | 5 | ### Race Car's Photo
6 | 7 | 8 | ### Hardware 9 | + System:
10 | NVIDIA Jetson TX1 with Jetpack 3.0 11 | 12 | + Camera:
13 | [ZED Stereo Camera](https://www.stereolabs.com) ( [ZED SDK](https://www.stereolabs.com/developers/) ) 14 | 15 | + Lidar:
16 | [Scanse Sweep](http://scanse.io)
17 | For more information look up Jim's blog post [JetsonHacks - Sweep Software Installing](http://www.jetsonhacks.com/2017/06/06/scanse-sweep-lidar-software-install/). 18 | 19 | ### Running Artificial Intelligence Command: 20 | `python3 ai.py` 21 | 22 | ### Using Predict Command: 23 | `python3 predict.py ` 24 | 25 | ### Model Training: 26 | `python3 train.py` 27 | 28 | ### Using TensorBoard: 29 | `tensorboard --logdir=Data/Checkpoints/./logs` 30 | 31 | ### Installing TensorFlow for Jetson TX1: 32 | Look up my [TensorFlow-For-Jetson-TX1](https://github.com/ardamavi/TensorFlow-For-Jetson-TX1) repository. 33 | 34 | ### Important Notes: 35 | - Used Python Version: 3.6 36 | - Install necessary modules with `sudo pip3 install -r requirements.txt` command. 37 | - Install [Sweeppy](https://github.com/scanse/sweep-sdk/tree/master/sweeppy) 38 | - Install [OpenCV with CUDA for Jetson TX1](http://docs.opencv.org/3.2.0/d6/d15/tutorial_building_tegra_cuda.html) 39 | -------------------------------------------------------------------------------- /get_model.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | 3 | import os 4 | from keras.models import Model 5 | from keras.layers import Input, Conv2D, Activation, MaxPooling2D, Flatten, Dense, Dropout, concatenate 6 | 7 | def save_model(model): 8 | if not os.path.exists('Data/Model/'): 9 | os.makedirs('Data/Model/') 10 | model_json = model.to_json() 11 | with open("Data/Model/model.json", "w") as model_file: 12 | model_file.write(model_json) 13 | model.save_weights("Data/Model/weights.h5") 14 | print('Model and weights saved') 15 | return 16 | 17 | 18 | def get_model(): 19 | img_inputs = Input(shape=(500, 500, 1)) 20 | lidar_inputs = Input(shape=(3,)) 21 | 22 | conv_1 = Conv2D(32, (4,4), strides=(2,2))(img_inputs) 23 | 24 | conv_2 = Conv2D(32, (4,4), strides=(2,2))(conv_1) 25 | 26 | conv_3 = Conv2D(32, (3,3), strides=(1,1))(conv_2) 27 | act_3 = Activation('relu')(conv_3) 28 | 29 | pooling_1 = MaxPooling2D(pool_size=(2, 2), strides=(2, 2))(act_3) 30 | 31 | flat_1 = Flatten()(pooling_1) 32 | 33 | fc = Dense(32)(flat_1) 34 | 35 | lidar_fc = Dense(32)(lidar_inputs) 36 | 37 | concatenate_layer = concatenate([fc, lidar_fc]) 38 | 39 | fc = Dense(10)(concatenate_layer) 40 | fc = Activation('relu')(fc) 41 | fc = Dropout(0.5)(fc) 42 | 43 | outputs = Dense(2)(fc) 44 | 45 | outputs = Activation('sigmoid')(outputs) 46 | 47 | 48 | model = Model(inputs=[img_inputs, lidar_inputs], outputs=[outputs]) 49 | 50 | model.compile(loss='mse', optimizer='adadelta', metrics=['accuracy']) 51 | 52 | print(model.summary()) 53 | 54 | return model 55 | 56 | if __name__ == '__main__': 57 | save_model(get_model()) 58 | -------------------------------------------------------------------------------- /ai.py: -------------------------------------------------------------------------------- 1 | # Arda Mavi 2 | 3 | import time 4 | import numpy as np 5 | from scipy.misc import imresize 6 | from multiprocessing import Process, Value, Array 7 | from predict import predict, get_ready_model 8 | from Sensor_Data.zed_process import get_zed_data, get_capture, release_capture 9 | from Sensor_Data.lidar_process import get_lidar_data, start_lidar, stop_lidar 10 | 11 | zed_data = Array('f', []) 12 | lidar_data = Array('f', []) 13 | data_flow = Value('i', 1) 14 | 15 | def zed_data_process(cap): 16 | while data_flow.value: 17 | zed_data = np.array(imresize(np.array(get_zed_data(cap)), (500, 500, 1))) 18 | 19 | def lidar_data_process(): 20 | while data_flow.value: 21 | lidar_data = np.array(get_lidar_data()) 22 | 23 | def ai(): 24 | print('Preparing model ...') 25 | model = get_ready_model() 26 | print('Model ready.') 27 | 28 | print('Preparing lidar ...') 29 | start_lidar() 30 | print('Lidar ready.') 31 | 32 | print('Preparing camera...') 33 | cap = get_capture() 34 | print('Camera ready.') 35 | 36 | data_flow.value = True 37 | 38 | print('Threads starting') 39 | # Start getting data process: 40 | camera_process = Process(target=zed_data_process, args=(cap,)) 41 | camera_process.start() 42 | print('Camera thread start.') 43 | 44 | lidar_process = Process(target=lidar_data_process) 45 | lidar_process.start() 46 | print('Lidar thread start.') 47 | 48 | print('AI will start in a short time.') 49 | time.sleep(2) 50 | 51 | while True: 52 | stereo_img = np.array(zed_data) 53 | lidar_map = np.array(lidar_data) 54 | try: 55 | if stereo_img.size != 0 and lidar_map.size != 0: 56 | print(predict(model, stereo_img, lidar_map)) 57 | except: 58 | print('AI Error !') 59 | break 60 | 61 | data_flow.value = False 62 | camera_process.join() 63 | lidar_process.join() 64 | 65 | stop_lidar() 66 | 67 | release_capture(cap) 68 | 69 | if __name__ == '__main__': 70 | ai() 71 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017 Arda Mavi 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------