Skip to content

Commit

Permalink
Fixed tutorials and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zaleslaw committed May 14, 2021
1 parent 7b7c48d commit dc5883a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 0.2.0 (01/05/2021)
# 0.2.0 (17/05/2021)
Features:
* Added [support for Functional API](https://github.com/JetBrains/KotlinDL/issues/23)
* Added [BatchNorm layer](https://github.com/JetBrains/KotlinDL/issues/34) for inference
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ To use KotlinDL in your project, add the following dependency to your `build.gra
implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-api:[KOTLIN-DL-VERSION]'
}
```
The latest KotlinDL version is 0.2.0-alpha-1.
The latest stable KotlinDL version is 0.1.1.
The latest KotlinDL version is 0.2.0.
The latest stable KotlinDL version is 0.2.0.

For more details, as well as for `pom.xml` and `build.gradle.kts` examples, please refer to the [Quick Start Guide](docs/quick_start_guide.md).

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apply plugin: "io.codearte.nexus-staging"

allprojects {
group = 'org.jetbrains.kotlinx'
version = '0.2.0-alpha-2'
version = '0.2.0'

apply plugin: "maven"
apply plugin: "kotlin"
Expand Down
28 changes: 15 additions & 13 deletions docs/transfer_learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,26 @@ You can do so via the Image Preprocessing Pipeline description, and building a d
Here's code that will go through a folder structure received via ```catDogsSmallDatasetPath()```, loads and resizes the images, and applies the VGG-19 specific preprocessing.

```kotlin
val catdogimages = catDogsSmallDatasetPath()
val dogsVsCatsDatasetPath = catDogsSmallDatasetPath()

val preprocessing: Preprocessing = preprocessingPipeline {
imagePreprocessing {
load {
pathToData = File(catdogimages)
imageShape = ImageShape(channels = 3)
val preprocessing: Preprocessing = preprocess {
transformImage {
load {
pathToData = File(dogsVsCatsDatasetPath)
imageShape = ImageShape(channels = NUM_CHANNELS)
colorMode = ColorOrder.BGR
labelGenerator = FromFolders(mapping = mapOf("cat" to 0, "dog" to 1))
}
resize {
outputHeight = 224
outputWidth = 224
}
resize {
outputHeight = IMAGE_SIZE.toInt()
outputWidth = IMAGE_SIZE.toInt()
interpolation = InterpolationType.BILINEAR
}
}
}
sharpen {
modelType = ModelType.VGG_19
transformTensor {
sharpen {
modelType = ModelType.VGG_19
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun main() {
colorMode = ColorOrder.BGR
}
rotate {
degrees = 30f
degrees = 60f
}
crop {
left = 12
Expand All @@ -60,8 +60,8 @@ fun main() {
bottom = 12
}
resize {
outputWidth = 400
outputHeight = 400
outputWidth = 300
outputHeight = 300
interpolation = InterpolationType.NEAREST
}
}
Expand All @@ -81,7 +81,7 @@ fun main() {
val rawImage = batchIter.next().x[1]

val frame = JFrame("Filters")
frame.contentPane.add(ImagesJPanel(rawImage, ImageShape(400, 400, 3)))
frame.contentPane.add(ImagesJPanel(rawImage, ImageShape(300, 300, 3)))
frame.setSize(1000, 1000)
frame.isVisible = true
frame.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ fun vgg19additionalTraining() {
val modelZoo = ModelZoo(commonModelDirectory = File("cache/pretrainedModels"), modelType = ModelType.VGG_19)
val model = modelZoo.loadModel() as Sequential

val catdogimages = dogsCatsSmallDatasetPath()
val dogsVsCatsDatasetPath = dogsCatsSmallDatasetPath()

val preprocessing: Preprocessing = preprocess {
transformImage {
load {
pathToData = File(catdogimages)
pathToData = File(dogsVsCatsDatasetPath)
imageShape = ImageShape(channels = NUM_CHANNELS)
colorMode = ColorOrder.BGR
labelGenerator = FromFolders(mapping = mapOf("cat" to 0, "dog" to 1))
Expand All @@ -77,7 +77,6 @@ fun vgg19additionalTraining() {
modelType = ModelType.VGG_19
}
}

}

val dataset = OnFlyImageDataset.create(preprocessing).shuffle()
Expand Down

0 comments on commit dc5883a

Please sign in to comment.