Skip to content

Commit 71cba4d

Browse files
committed
Cleanup
1 parent afd6f10 commit 71cba4d

File tree

8 files changed

+170
-166
lines changed

8 files changed

+170
-166
lines changed

src/convnets/inception.jl

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,18 @@ function inceptionv4_c()
279279
end
280280

281281
"""
282-
inceptionv4(; inchannels = 3, dropout = 0.0, nclasses = 1000)
282+
inceptionv4(; inchannels = 3, drop_rate = 0.0, nclasses = 1000)
283283
284284
Create an Inceptionv4 model.
285285
([reference](https://arxiv.org/abs/1602.07261))
286286
287287
# Arguments
288288
289289
- `inchannels`: number of input channels.
290-
- `dropout`: rate of dropout in classifier head.
290+
- `drop_rate`: rate of dropout in classifier head.
291291
- `nclasses`: the number of output classes.
292292
"""
293-
function inceptionv4(; inchannels = 3, dropout = 0.0, nclasses = 1000)
293+
function inceptionv4(; inchannels = 3, drop_rate = 0.0, nclasses = 1000)
294294
body = Chain(conv_bn((3, 3), inchannels, 32; stride = 2)...,
295295
conv_bn((3, 3), 32, 32)...,
296296
conv_bn((3, 3), 32, 64; pad = 1)...,
@@ -313,12 +313,13 @@ function inceptionv4(; inchannels = 3, dropout = 0.0, nclasses = 1000)
313313
inceptionv4_c(),
314314
inceptionv4_c(),
315315
inceptionv4_c())
316-
head = Chain(GlobalMeanPool(), MLUtils.flatten, Dropout(dropout), Dense(1536, nclasses))
316+
head = Chain(GlobalMeanPool(), MLUtils.flatten, Dropout(drop_rate),
317+
Dense(1536, nclasses))
317318
return Chain(body, head)
318319
end
319320

320321
"""
321-
Inceptionv4(; pretrain = false, inchannels = 3, dropout = 0.0, nclasses = 1000)
322+
Inceptionv4(; pretrain = false, inchannels = 3, drop_rate = 0.0, nclasses = 1000)
322323
323324
Creates an Inceptionv4 model.
324325
([reference](https://arxiv.org/abs/1602.07261))
@@ -327,7 +328,7 @@ Creates an Inceptionv4 model.
327328
328329
- `pretrain`: set to `true` to load the pre-trained weights for ImageNet
329330
- `inchannels`: number of input channels.
330-
- `dropout`: rate of dropout in classifier head.
331+
- `drop_rate`: rate of dropout in classifier head.
331332
- `nclasses`: the number of output classes.
332333
333334
!!! warning
@@ -338,7 +339,7 @@ struct Inceptionv4
338339
layers::Any
339340
end
340341

341-
function Inceptionv4(; pretrain = false, inchannels = 3, dropout = 0.0, nclasses = 1000)
342+
function Inceptionv4(; pretrain = false, inchannels = 3, drop_rate = 0.0, nclasses = 1000)
342343
layers = inceptionv4(; inchannels, dropout, nclasses)
343344
pretrain && loadpretrain!(layers, "Inceptionv4")
344345
return Inceptionv4(layers)
@@ -419,18 +420,18 @@ function block8(scale = 1.0f0; activation = identity)
419420
end
420421

421422
"""
422-
inceptionresnetv2(; inchannels = 3, dropout = 0.0, nclasses = 1000)
423+
inceptionresnetv2(; inchannels = 3, drop_rate =0.0, nclasses = 1000)
423424
424425
Creates an InceptionResNetv2 model.
425426
([reference](https://arxiv.org/abs/1602.07261))
426427
427428
# Arguments
428429
429430
- `inchannels`: number of input channels.
430-
- `dropout`: rate of dropout in classifier head.
431+
- `drop_rate`: rate of dropout in classifier head.
431432
- `nclasses`: the number of output classes.
432433
"""
433-
function inceptionresnetv2(; inchannels = 3, dropout = 0.0, nclasses = 1000)
434+
function inceptionresnetv2(; inchannels = 3, drop_rate = 0.0, nclasses = 1000)
434435
body = Chain(conv_bn((3, 3), inchannels, 32; stride = 2)...,
435436
conv_bn((3, 3), 32, 32)...,
436437
conv_bn((3, 3), 32, 64; pad = 1)...,
@@ -446,12 +447,13 @@ function inceptionresnetv2(; inchannels = 3, dropout = 0.0, nclasses = 1000)
446447
[block8(0.20f0) for _ in 1:9]...,
447448
block8(; activation = relu),
448449
conv_bn((1, 1), 2080, 1536)...)
449-
head = Chain(GlobalMeanPool(), MLUtils.flatten, Dropout(dropout), Dense(1536, nclasses))
450+
head = Chain(GlobalMeanPool(), MLUtils.flatten, Dropout(drop_rate),
451+
Dense(1536, nclasses))
450452
return Chain(body, head)
451453
end
452454

453455
"""
454-
InceptionResNetv2(; pretrain = false, inchannels = 3, dropout = 0.0, nclasses = 1000)
456+
InceptionResNetv2(; pretrain = false, inchannels = 3, drop_rate =0.0, nclasses = 1000)
455457
456458
Creates an InceptionResNetv2 model.
457459
([reference](https://arxiv.org/abs/1602.07261))
@@ -460,7 +462,7 @@ Creates an InceptionResNetv2 model.
460462
461463
- `pretrain`: set to `true` to load the pre-trained weights for ImageNet
462464
- `inchannels`: number of input channels.
463-
- `dropout`: rate of dropout in classifier head.
465+
- `drop_rate`: rate of dropout in classifier head.
464466
- `nclasses`: the number of output classes.
465467
466468
!!! warning
@@ -471,9 +473,9 @@ struct InceptionResNetv2
471473
layers::Any
472474
end
473475

474-
function InceptionResNetv2(; pretrain = false, inchannels = 3, dropout = 0.0,
476+
function InceptionResNetv2(; pretrain = false, inchannels = 3, drop_rate = 0.0,
475477
nclasses = 1000)
476-
layers = inceptionresnetv2(; inchannels, dropout, nclasses)
478+
layers = inceptionresnetv2(; inchannels, drop_rate, nclasses)
477479
pretrain && loadpretrain!(layers, "InceptionResNetv2")
478480
return InceptionResNetv2(layers)
479481
end
@@ -533,18 +535,18 @@ function xception_block(inchannels, outchannels, nrepeats; stride = 1,
533535
end
534536

535537
"""
536-
xception(; inchannels = 3, dropout = 0.0, nclasses = 1000)
538+
xception(; inchannels = 3, drop_rate =0.0, nclasses = 1000)
537539
538540
Creates an Xception model.
539541
([reference](https://arxiv.org/abs/1610.02357))
540542
541543
# Arguments
542544
543545
- `inchannels`: number of input channels.
544-
- `dropout`: rate of dropout in classifier head.
546+
- `drop_rate`: rate of dropout in classifier head.
545547
- `nclasses`: the number of output classes.
546548
"""
547-
function xception(; inchannels = 3, dropout = 0.0, nclasses = 1000)
549+
function xception(; inchannels = 3, drop_rate = 0.0, nclasses = 1000)
548550
body = Chain(conv_bn((3, 3), inchannels, 32; stride = 2, bias = false)...,
549551
conv_bn((3, 3), 32, 64; bias = false)...,
550552
xception_block(64, 128, 2; stride = 2, start_with_relu = false),
@@ -554,7 +556,8 @@ function xception(; inchannels = 3, dropout = 0.0, nclasses = 1000)
554556
xception_block(728, 1024, 2; stride = 2, grow_at_start = false),
555557
depthwise_sep_conv_bn((3, 3), 1024, 1536; pad = 1)...,
556558
depthwise_sep_conv_bn((3, 3), 1536, 2048; pad = 1)...)
557-
head = Chain(GlobalMeanPool(), MLUtils.flatten, Dropout(dropout), Dense(2048, nclasses))
559+
head = Chain(GlobalMeanPool(), MLUtils.flatten, Dropout(drop_rate),
560+
Dense(2048, nclasses))
558561
return Chain(body, head)
559562
end
560563

@@ -563,7 +566,7 @@ struct Xception
563566
end
564567

565568
"""
566-
Xception(; pretrain = false, inchannels = 3, dropout = 0.0, nclasses = 1000)
569+
Xception(; pretrain = false, inchannels = 3, drop_rate =0.0, nclasses = 1000)
567570
568571
Creates an Xception model.
569572
([reference](https://arxiv.org/abs/1610.02357))
@@ -572,15 +575,15 @@ Creates an Xception model.
572575
573576
- `pretrain`: set to `true` to load the pre-trained weights for ImageNet.
574577
- `inchannels`: number of input channels.
575-
- `dropout`: rate of dropout in classifier head.
578+
- `drop_rate`: rate of dropout in classifier head.
576579
- `nclasses`: the number of output classes.
577580
578581
!!! warning
579582
580583
`Xception` does not currently support pretrained weights.
581584
"""
582-
function Xception(; pretrain = false, inchannels = 3, dropout = 0.0, nclasses = 1000)
583-
layers = xception(; inchannels, dropout, nclasses)
585+
function Xception(; pretrain = false, inchannels = 3, drop_rate = 0.0, nclasses = 1000)
586+
layers = xception(; inchannels, drop_rate, nclasses)
584587
pretrain && loadpretrain!(layers, "xception")
585588
return Xception(layers)
586589
end

0 commit comments

Comments
 (0)