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
/* | |
* Copyright 2016 The BigDL Authors. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
package com.intel.analytics.bigdl.example | |
import com.intel.analytics.bigdl._ | |
import com.intel.analytics.bigdl.nn.Module | |
import com.intel.analytics.bigdl.nn.abstractnn.{AbstractModule, Activity} | |
import com.intel.analytics.bigdl.tensor.Tensor | |
import com.intel.analytics.bigdl.utils.Engine | |
import org.apache.hadoop.fs.Path | |
import org.apache.spark.SparkContext | |
import org.apache.spark.sql.SparkSession |
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
// compute rle iou | |
def rleIOU(detection: Array[Tensor[Float]], groud: Array[Tensor[Float]], | |
height: Array[Int], width: Array[Int], | |
dtNumber: Int, gtNumber: Int, | |
iscrowd: Array[Boolean]): Array[Float] = { | |
val gtBbox = Tensor[Float](gtNumber, 4) | |
val dtBbox = Tensor[Float](dtNumber, 4) | |
for (i <- 1 to gtNumber) { | |
val box = gtBbox.select(1, i) |