Skip to content

Commit 1f70b95

Browse files
authored
Merge pull request larymak#217 from Ankita1811/main
Vehicle Detection
2 parents 5650b8a + c1176e1 commit 1f70b95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1164
-0
lines changed

Vehicle-Detection/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+

Vehicle-Detection/README.md

Lines changed: 1 addition & 0 deletions

Vehicle-Detection/Vehicle_detection.ipynb

Lines changed: 440 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.

Vehicle-Detection/images/0001.jpg

309 KB

Vehicle-Detection/images/0002.jpg

331 KB

Vehicle-Detection/images/0003.jpg

322 KB

Vehicle-Detection/images/0004.jpg

307 KB

Vehicle-Detection/images/0005.jpg

318 KB

Vehicle-Detection/images/0006.jpg

328 KB

Vehicle-Detection/images/0007.jpg

336 KB

Vehicle-Detection/images/0008.jpg

313 KB

Vehicle-Detection/images/0009.jpg

337 KB

Vehicle-Detection/images/0010.jpg

340 KB

Vehicle-Detection/images/0011.jpg

345 KB

Vehicle-Detection/images/0012.jpg

331 KB

Vehicle-Detection/images/0013.jpg

344 KB

Vehicle-Detection/images/0014.jpg

342 KB

Vehicle-Detection/images/0015.jpg

343 KB

Vehicle-Detection/images/0016.jpg

326 KB

Vehicle-Detection/images/0017.jpg

345 KB

Vehicle-Detection/images/0018.jpg

341 KB

Vehicle-Detection/images/0019.jpg

351 KB

Vehicle-Detection/images/0020.jpg

343 KB

Vehicle-Detection/images/0021.jpg

369 KB

Vehicle-Detection/images/0022.jpg

339 KB

Vehicle-Detection/images/0023.jpg

313 KB

Vehicle-Detection/images/0024.jpg

319 KB

Vehicle-Detection/images/0025.jpg

300 KB

Vehicle-Detection/images/0026.jpg

292 KB

Vehicle-Detection/images/0027.jpg

282 KB

Vehicle-Detection/images/0028.jpg

304 KB

Vehicle-Detection/images/0029.jpg

289 KB

Vehicle-Detection/images/0030.jpg

282 KB

Vehicle-Detection/images/0031.jpg

258 KB

Vehicle-Detection/images/0032.jpg

307 KB

Vehicle-Detection/images/0033.jpg

315 KB

Vehicle-Detection/images/0034.jpg

326 KB

Vehicle-Detection/images/0035.jpg

313 KB

Vehicle-Detection/images/0036.jpg

287 KB

Vehicle-Detection/images/0037.jpg

328 KB

Vehicle-Detection/images/0038.jpg

308 KB

Vehicle-Detection/images/0039.jpg

314 KB

Vehicle-Detection/images/0040.jpg

347 KB
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

Vehicle-Detection/out/test.jpg

244 KB
Binary file not shown.
Binary file not shown.
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)