Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Update for QuPath v0.3.0-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
petebankhead committed Aug 8, 2021
1 parent dbc985c commit d4f8600
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ and remains in a not-quite-complete state.
Its previous main use was to run [StarDist](https://qupath.readthedocs.io/en/0.2/docs/advanced/stardist.html)
nucleus identification, although the new [QuPath StarDist extension](https://github.com/qupath/qupath-extension-stardist) does not require that TensorFlow is available.

> **Important!** TensorFlow Java does not currently support Mac computers with Apple silicon.

## Building

There is no pre-built version of the TensorFlow extension at this time, because most people shouldn't need it and there are lots of different permutations of dependencies that might be required for different platforms.

For that reason, it needs to be built from source.
If you want to match to a specific version, you can download the source from the [releases](https://github.com/qupath/qupath-extension-tensorflow/releases) page.


### Extension + dependencies separately

You can build the extension with
Expand All @@ -37,7 +45,7 @@ extension and all its dependencies with
gradlew clean shadowjar
```

### GPU support
### Alternative platforms

The default build process will use TensorFlow for the CPU.

Expand All @@ -48,11 +56,35 @@ To use any of these, add the platform to any of the building tasks above.
For example, to create a single GPU-friendly jar, use

```bash
gradlew clean shadowjar -P platform=gpu
gradlew clean build copyDependencies -P platform=gpu
```

The platforms available at the time of writing are `mkl`, `gpu`, `mkl-gpu`.

> Not all options are available for all operating systems.
> For example, GPU support is not available with macOS.

### GPU support

When using `platform=gpu`, you will need
* an NVIDIA GPU
* CUDA and cuDNN

Installation may be simplified if you include

```bash
gradlew clean build copyDependencies -P platform=gpu -Pcuda-redist
```

to download the required CUDA files via JavaCPP.

Before using this option, please check https://github.com/bytedeco/javacpp-presets/tree/master/cuda for
the terms of license agreements for NVIDIA software included in the archives.

> **Warning!** At the time of writing, the CUDA version used with TensorFlow Java differs from that
> used with OpenCV via JavaCPP. This is likely to cause problems if trying to use both.

## Installing

Expand Down
13 changes: 11 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ version = "0.3.0-rc2"
dependencies {
def tensorflowVersion = "0.3.2"
def cudaVersion = "11.0-8.0-1.5.4" // Warning! This doesn't match version with QuPath v0.3.0 + opencv-platform-gpu
def qupathVersion = "0.3.0-SNAPSHOT" // For now
def qupathVersion = "0.3.0-rc2" // For now

def platform = project.findProperty("platform")

Expand All @@ -62,13 +62,21 @@ dependencies {
testImplementation "io.github.qupath:qupath-gui-fx:${qupathVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.2"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'

}

processResources {
from ("${projectDir}/LICENSE.txt") {
into 'licenses/'
}

doLast {
if (useCuda) {
logger.quiet("Requesting CUDA support - by downloading these archives you agree to the terms of the license " +
" agreements for NVIDIA software included in the archives.")
logger.quiet("See https://github.com/bytedeco/javacpp-presets/tree/master/cuda for more information.")
}
}
}

tasks.register("copyDependencies", Copy) {
Expand All @@ -90,6 +98,7 @@ java {
withSourcesJar()
if (project.properties['javadocs'])
withJavadocJar()

}

/*
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/qupath/ext/tensorflow/TensorFlowExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import qupath.lib.common.Version;
import qupath.lib.gui.QuPathGUI;
import qupath.lib.gui.extensions.GitHubProject;
import qupath.lib.gui.extensions.QuPathExtension;
Expand Down Expand Up @@ -61,6 +62,10 @@ public GitHubRepo getRepository() {
return GitHubRepo.create(getName(), "qupath", "qupath-extension-tensorflow");
}

@Override
public Version getQuPathVersion() {
return Version.parse("0.3.0-rc2");
}


}

0 comments on commit d4f8600

Please sign in to comment.