#sg_planetearth Group Project
Project members:
Berenice Terwey - @Berenice
Shudipto Trafder - @Shudipto Trafder
Pooja Vinod - @Pooja Vinod
Ingus Terbets - @Ingus Terbets
Akash Antony - @Akash Antony
Ramkrishna Acharya - @Viper
Agata Gruza - @Agata [OR, USA]
Sayed Maheen Basheer - @Sayed Maheen Basheer
Abhishek Lalwani - @Abhishek Lalwani
George Christopoulos - @George Christopoulos
Sourav Kumar - @sourav kumar
Alexander Villasoto - @Alexander Villasoto
Laura Truncellito - @LauraT
This is a project for the Project Showcase Challenge of the Udacity Facebook Secure and Private AI Challenge Scholarship Program.
The purpose of the project is to detect smog using image classifcation algorithms. You can upload images here and our algorithms will know if the environment has smog or clear: https://smog4000.onrender.com/
A project by #sg_planetearth (Facebook Secure and Private AI Scholarship Challenge 2019)
Description:
Smog Detection project has been created as a collaborative team effort between
Facebook Secure and Private AI Scholars on #sg_planetearth. Main focus of the project is to provide Deep Learning solutions to solve most concerning real world problems, such as Climate Change, Food Security, Plastic Pollution, Deep Fake, Oceanic Pollution, Industrial Nuclear Waste, Clean Energy and more(using AI for social good). Currently our team is focusing on Smog and Fog detection on highways.
Why is it important? Why should we care?
Sudden appearance of smog and/or fog on the highway more often than not cause serious and sometimes fatal accidents. Smog is a main agent for severe air pollution. It can aggravate health problems including problems with breathing and sleeping, as well as it can inversely damage plants and forest cover.
Solution:
Monitoring, early smog detection and preventive action. By using traffic cameras and train a model to recognize the smog/fog patterns, we can automate the alert and send notification in a timely manner. When smog/fog appears, the system notifies drivers who are within specified range about an upcoming “obstacle”.
In any practical situation, there are other components that need to be taken into consideration as well. For example, presence of flying birds and any type of material that will block camera view. To identify the range of vision sensors need to be added to the solution.
Our approach:
There are plenty of existing solutions and advancements in computer vision. Our approach is to use Machine Learning Image Detection and train a CNN model. Smog Detection is a smog classification project, where images are arranged into two main cathegories: "Smog/Fog/NotClearlyVisible Highways" and "Clearly Visible Highways".
Project objective:
Smog is a byproduct of the global climate change scenario. As we move further into the industrialized age, Smog continues to pollute our air, reduce visibility on roads and is a leading cause of accidents on roads. The primary goal of the project is to avoid and help reduce rate of accidents in self driving vehicles by using this classifier model as one of the key components attached on traffic cams, so that the vehicle can automatically be alerted about smog on the roads/streets (highways) be it in heavy, medium or low traffic in order to adjust it's dynamics like speed, steering rotation, lanes etc. We can use the prediction output labels from the model to alert the vehicle / driver.
Dataset:
Since inception, people in the group have taken their task most seriously. They contributed towards building unique dataset which now has more than 4,000 images divided evenly between above-mentioned two groups. Our collection consists of:
Rules and regulations for selecting picture:
- Only Highway(street)
- Avoid large quantity of people
- Avoid accident
- Avoid Night Picture
- Avoid bird eye view
- Avoid large copyright watermark picture
- Acceptable image format jpg, jpeg, png, jfif, webp
If in doubt about synthetic picture we were using https://people.ee.ethz.ch/~csakarid/SFSU_synthetic/
To detect and remove duplicates (regardless of format and resolution), we were using https://dupeguru.voltaicideas.net/ It's a nice and simple an Open Source tool that will work cross different platforms (Linux, OS X, Windows).
You can download our dataset here: https://drive.google.com/file/d/1ifKDpuF3zvEvsuBfZ4ZogSqWKZSxllKK/view?usp=sharing
Contributors:
- @Shudipto Trafder
- @Berenice
- @Agata [OR, USA]
- @Ingus Terbets
- @Akash Antony
- @Alexander Villasoto
- @Pooja Vinod
- @Viper
- @sourav kumar
- @George Christopoulos
- @Sayed Maheen Basheer
- @Abhishek Lalwani
- @LauraT
UPDATES:
Date | Contribution |
---|---|
08/05/19 | 13th batch of images uploaded (20 for Clear and 20 for Smog folder) |
08/04/19 | 12th batch of images uploaded (20 for Clear and 20 for Smog folder) |
08/03/19 | 11th batch of images uploaded (20 for Clear and 20 for Smog folder) |
08/02/19 | 10th batch of images uploaded (20 for Clear and 20 for Smog folder) |
08/01/19 | 9th batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/31/19 | 8th batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/30/19 | 7th batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/29/19 | 6th batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/28/19 | 5th batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/27/19 | 4th batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/26/19 | 3rd batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/25/19 | 2nd batch of images uploaded (20 for Clear and 20 for Smog folder) |
07/24/19 | 1st batch of images uploaded (20 for Clear and 20 for Smog folder) |
More info:
https://github.com/SayedMaheen/SmogDetection
https://github.com/SayedMaheen/PlanetEarth
https://github.com/ingus-t/SmogDetection
https://github.com/ingus-t/SmogDetectionCombined
https://github.com/SayedMaheen/sg_PlanetEarth
Check out this exclusive web-app we have deployed for our project at https://smog4000.onrender.com/. At this site, you can upload your Smog/Clear images and test the accuracy of our classification system.
'Smog' Detection
'Clear' Detection
While the application works for all images, it works best for highway images.
This is a descriptive summary of Model Architecture we have implemented, and the Data Augmentations we have applied.
Images captured by traffic cam.
Prediction as label '0'(clear view) or '1'(smog detected).
- transforms.RandomRotation(30), transforms.RandomHorizontalFlip(), transforms.Resize(256), transforms.ColorJitter(0.1), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
So, there are five modules which contain deeper sublayers. Let's go through them one by one:
- CNN layers : 7
- Linear layers : 2
- Pooling layers : 4
- Batch normalization layers : 7
conv1 :
- CNN layers : Conv2d(3, 32, 3, padding=1), Conv2d(32, 32, 3, stride=2, padding=1)
- Pooling layer : MaxPool2d(2, 2)
- Batch normalization layer : BatchNorm2d(32), nn.BatchNorm2d(32),
conv2 :
- CNN layers : Conv2d(32, 64, 3, padding=1), Conv2d(64, 64, 3, stride=2, padding=1)
- Pooling layer : MaxPool2d(2, 2)
- Batch normalization layer : BatchNorm2d(32), nn.BatchNorm2d(64),
conv3 :
- CNN layers : Conv2d(64, 128, 3, padding=1), Conv2d(128, 128, 3, stride=2, padding=1)
- Pooling layer : MaxPool2d(2, 2)
- Batch normalization layer : BatchNorm2d(128), BatchNorm2d(128)
conv4 :
- CNN layers : Conv2d(128, 256, 3, padding=1)
- Pooling layer : MaxPool2d(2, 2)
- Batch normalization layer : BatchNorm2d(256)
fc :
- Linear layers : Linear(256, 128), Linear(128, 2)
mila activation has been used. Activation Mila (@Diganta's new activation) https://github.com/digantamisra98/Mila
Adam optimizer is used here.
CrossEntropyLoss is used.
- lr schedular = StepLR(optimizer, step_size=10, gamma=0.5)
- lr = 0.001
epoch : 50
Test Loss:36.734721
Accuracy: 99.0000
- Test Accuracy of 0: 98% (389/393)
- Test Accuracy of 1: 98% (378/382)
Test Accuracy (Overall): 98% (767/775)
Find the notebook for this implementation here
- Libraries used: keras 2.2.4, numpy, matplotlib etc
- Trained: On google Colab
- Dataset Used: Smog4000
Smog4000 dataset created by our team.
- Rescale range: 1./255
- shear and zoom: 0.2
- color: RGB
- Outshape: 224 X 224
Custom CNN model is used here. Complete summary of model architecture is given below:
The Sequential model have 3 blocks of CNN layers and one final linear layer. In each CNN block we have:
- Convolution layers of same out filters(32, 32, 64, 64, 128, 128)
- Filter shape: (3, 3)
- Activation Function: relu(Rectified Linear Unit)
- MaxPooling: pool size(3, 3)
- BatchNormalization
- Dropout: 0.25
The Final block is for linear layers. It has:
-
Flatten
-
Dense of out 256 and relu
-
BatchNormalization
-
Dropout of 0.5
-
Classification layer with sigmoid
-
Total parameters: 1,469,346
- Optimizer: Adam(Adaptive Momentum) Optimizer is used on this model.
- Learning rate: default(0.001)
- Loss function: Categorical_crossentropy (categories: clear, smog)
- Epochs: 10
- Batch Size: 32
- Train Accuracy: 0.9968
- Validation Accuracy: 0.9921
- Test Accuracy: 0.985
- Train time: 750s per epochs
- Usage of less parameters
- Test with different optimizer and loss functions