Skip to content

Commit d22536a

Browse files
committed
Course 4 Week 3
autonomous driving classes recognition
1 parent b9cfeb2 commit d22536a

17 files changed

+3007
-0
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ResNet50.h5 filter=lfs diff=lfs merge=lfs -text
2+
ResNets/ResNet50.h5 filter=lfs diff=lfs merge=lfs -text
3+
Course[[:space:]]4/Week[[:space:]]2/ResNets/ResNet50.h5 filter=lfs diff=lfs merge=lfs -text
Binary file not shown.

Course 4/Week 3/Autonomous+driving+application+-+Car+detection+-+v1.ipynb

Lines changed: 1394 additions & 0 deletions
Large diffs are not rendered by default.

Course 4/Week 3/Autonomous+driving+application+-+Car+detection+-+v1.py

Lines changed: 841 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Drive.ai Sample Dataset</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.

Course 4/Week 3/LICENSE

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
COPYRIGHT
2+
3+
All contributions by deeplearning.ai (Kian Katanforoosh, Younes Bensouda Mourri, Andrew Ng):
4+
Copyright (c) 2017, deeplearning.ai (Kian Katanforoosh, Younes Bensouda Mourri, Andrew Ng).
5+
All rights reserved.
6+
7+
This work incorporates contributions due to Allan Zelener released under an MIT License, reproduced below:
8+
9+
----------------------------------------------------
10+
All contributions by Allan Zelener:
11+
Copyright (c) 2017, Allan Zelener.
12+
All rights reserved.
13+
14+
All other contributions:
15+
Copyright (c) 2017, the respective contributors.
16+
All rights reserved.
17+
18+
Each contributor holds copyright over their respective contributions.
19+
The project versioning (Git) records all such contribution source information.
20+
21+
LICENSE
22+
23+
The MIT License (MIT)
24+
25+
Permission is hereby granted, free of charge, to any person obtaining a copy
26+
of this software and associated documentation files (the "Software"), to deal
27+
in the Software without restriction, including without limitation the rights
28+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29+
copies of the Software, and to permit persons to whom the Software is
30+
furnished to do so, subject to the following conditions:
31+
32+
The above copyright notice and this permission notice shall be included in all
33+
copies or substantial portions of the Software.
34+
35+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41+
SOFTWARE.
42+
----------------------------------------------------
43+
124 KB
Binary file not shown.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ with Reserved Font Name Fira Mono.
2+
3+
Copyright (c) 2014, Telefonica S.A.
4+
5+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
6+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
14+
15+
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
16+
17+
DEFINITIONS
18+
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
19+
20+
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
21+
22+
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
23+
24+
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
25+
26+
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
27+
28+
PERMISSION & CONDITIONS
29+
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
30+
31+
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
32+
33+
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
34+
35+
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
36+
37+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
38+
39+
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
40+
41+
TERMINATION
42+
This license becomes null and void if any of the above conditions are not met.
43+
44+
DISCLAIMER
45+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
person
2+
bicycle
3+
car
4+
motorbike
5+
aeroplane
6+
bus
7+
train
8+
truck
9+
boat
10+
traffic light
11+
fire hydrant
12+
stop sign
13+
parking meter
14+
bench
15+
bird
16+
cat
17+
dog
18+
horse
19+
sheep
20+
cow
21+
elephant
22+
bear
23+
zebra
24+
giraffe
25+
backpack
26+
umbrella
27+
handbag
28+
tie
29+
suitcase
30+
frisbee
31+
skis
32+
snowboard
33+
sports ball
34+
kite
35+
baseball bat
36+
baseball glove
37+
skateboard
38+
surfboard
39+
tennis racket
40+
bottle
41+
wine glass
42+
cup
43+
fork
44+
knife
45+
spoon
46+
bowl
47+
banana
48+
apple
49+
sandwich
50+
orange
51+
broccoli
52+
carrot
53+
hot dog
54+
pizza
55+
donut
56+
cake
57+
chair
58+
sofa
59+
pottedplant
60+
bed
61+
diningtable
62+
toilet
63+
tvmonitor
64+
laptop
65+
mouse
66+
remote
67+
keyboard
68+
cell phone
69+
microwave
70+
oven
71+
toaster
72+
sink
73+
refrigerator
74+
book
75+
clock
76+
vase
77+
scissors
78+
teddy bear
79+
hair drier
80+
toothbrush
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
car
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828

Course 4/Week 3/out/test.jpg

244 KB
Loading
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
"""Darknet19 Model Defined in Keras."""
2+
import functools
3+
from functools import partial
4+
5+
from keras.layers import Conv2D, MaxPooling2D
6+
from keras.layers.advanced_activations import LeakyReLU
7+
from keras.layers.normalization import BatchNormalization
8+
from keras.models import Model
9+
from keras.regularizers import l2
10+
11+
from ..utils import compose
12+
13+
# Partial wrapper for Convolution2D with static default argument.
14+
_DarknetConv2D = partial(Conv2D, padding='same')
15+
16+
17+
@functools.wraps(Conv2D)
18+
def DarknetConv2D(*args, **kwargs):
19+
"""Wrapper to set Darknet weight regularizer for Convolution2D."""
20+
darknet_conv_kwargs = {'kernel_regularizer': l2(5e-4)}
21+
darknet_conv_kwargs.update(kwargs)
22+
return _DarknetConv2D(*args, **darknet_conv_kwargs)
23+
24+
25+
def DarknetConv2D_BN_Leaky(*args, **kwargs):
26+
"""Darknet Convolution2D followed by BatchNormalization and LeakyReLU."""
27+
no_bias_kwargs = {'use_bias': False}
28+
no_bias_kwargs.update(kwargs)
29+
return compose(
30+
DarknetConv2D(*args, **no_bias_kwargs),
31+
BatchNormalization(),
32+
LeakyReLU(alpha=0.1))
33+
34+
35+
def bottleneck_block(outer_filters, bottleneck_filters):
36+
"""Bottleneck block of 3x3, 1x1, 3x3 convolutions."""
37+
return compose(
38+
DarknetConv2D_BN_Leaky(outer_filters, (3, 3)),
39+
DarknetConv2D_BN_Leaky(bottleneck_filters, (1, 1)),
40+
DarknetConv2D_BN_Leaky(outer_filters, (3, 3)))
41+
42+
43+
def bottleneck_x2_block(outer_filters, bottleneck_filters):
44+
"""Bottleneck block of 3x3, 1x1, 3x3, 1x1, 3x3 convolutions."""
45+
return compose(
46+
bottleneck_block(outer_filters, bottleneck_filters),
47+
DarknetConv2D_BN_Leaky(bottleneck_filters, (1, 1)),
48+
DarknetConv2D_BN_Leaky(outer_filters, (3, 3)))
49+
50+
51+
def darknet_body():
52+
"""Generate first 18 conv layers of Darknet-19."""
53+
return compose(
54+
DarknetConv2D_BN_Leaky(32, (3, 3)),
55+
MaxPooling2D(),
56+
DarknetConv2D_BN_Leaky(64, (3, 3)),
57+
MaxPooling2D(),
58+
bottleneck_block(128, 64),
59+
MaxPooling2D(),
60+
bottleneck_block(256, 128),
61+
MaxPooling2D(),
62+
bottleneck_x2_block(512, 256),
63+
MaxPooling2D(),
64+
bottleneck_x2_block(1024, 512))
65+
66+
67+
def darknet19(inputs):
68+
"""Generate Darknet-19 model for Imagenet classification."""
69+
body = darknet_body()(inputs)
70+
logits = DarknetConv2D(1000, (1, 1), activation='softmax')(body)
71+
return Model(inputs, logits)

0 commit comments

Comments
 (0)