Created
February 25, 2018 19:04
-
-
Save makorowy/cf1aac8c65279f66427d6ed0b60394e4 to your computer and use it in GitHub Desktop.
TensorFlow - Hot or Not example. Creating a classifier.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
private lateinit var classifier: Classifier | |
//other properties | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
checkPermissions() | |
} | |
private fun checkPermissions() { | |
if (arePermissionAlreadyGranted()) { | |
init() | |
} else { | |
requestPermissions() | |
} | |
} | |
private fun init() { | |
createClassifier() | |
takePhoto() | |
} | |
private fun createClassifier() { | |
classifier = ImageClassifierFactory.create( | |
assets, | |
GRAPH_FILE_PATH, | |
LABELS_FILE_PATH, | |
IMAGE_SIZE, | |
GRAPH_INPUT_NAME, | |
GRAPH_OUTPUT_NAME | |
) | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment