-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
762 additions
and
197 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/// @file | ||
/// @brief Interface for counting fish. | ||
/// @copyright Copyright (C) 2018 CVision AI. | ||
/// @license This file is part of OpenEM, released under GPLv3. | ||
// OpenEM is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with OpenEM. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#ifndef OPENEM_DEPLOY_COUNT_H_ | ||
#define OPENEM_DEPLOY_COUNT_H_ | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "detect.h" | ||
#include "classify.h" | ||
#include "error_codes.h" | ||
|
||
namespace openem { | ||
namespace count { | ||
|
||
/// Class for finding keyframes. | ||
class KeyframeFinder { | ||
public: | ||
/// Constructor. | ||
KeyframeFinder(); | ||
|
||
/// Destructor. | ||
~KeyframeFinder(); | ||
|
||
/// Initializes the keyframe finder. | ||
/// @param model_path Path to protobuf file containing model. | ||
/// @param img_width Width of image input to detector. | ||
/// @param img_height Height of image input to detector. | ||
/// @param gpu_fraction Fraction of GPU memory that may be allocated to | ||
/// this object. | ||
/// @return Error code. | ||
ErrorCode Init( | ||
const std::string& model_path, | ||
int img_width, | ||
int img_height, | ||
double gpu_fraction=1.0); | ||
|
||
/// Finds keyframes in a given sequence. | ||
/// @param classifications Sequence of outputs from classifier. Outer | ||
/// vector corresponds to frames, inner corresponds to detections in each | ||
/// frame. | ||
/// @param detections Sequence of outputs from detector. Outer vector | ||
/// corresponds to frames, inner corresponds to detections in each frame. | ||
/// @param keyframes Vector of keyframes in the sequence. The length of | ||
/// this vector is the number of fish in the sequence. The values | ||
/// are the indices of the classification and detection vectors. | ||
/// @return Error code. | ||
ErrorCode Process( | ||
const std::vector<std::vector<classify::Classification>>& classifications, | ||
const std::vector<std::vector<detect::Detection>>& detections, | ||
std::vector<int>* keyframes); | ||
private: | ||
/// Forward declaration of implementation class. | ||
class KeyframeFinderImpl; | ||
|
||
/// Pointer to implementation. | ||
std::unique_ptr<KeyframeFinderImpl> impl_; | ||
}; | ||
|
||
} // namespace count | ||
} // namespace openem | ||
|
||
#endif // OPENEM_DEPLOY_COUNT_H_ | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ add_library(openem | |
find_ruler.cc | ||
detect.cc | ||
classify.cc | ||
count.cc | ||
util.cc | ||
model.cc | ||
video.cc | ||
|
Oops, something went wrong.