Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding logs to sfmExpanding #1795

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ void BundleAdjustmentCeres::createJacobian(const sfmData::SfMData& sfmData, ERef

bool BundleAdjustmentCeres::adjust(sfmData::SfMData& sfmData, ERefineOptions refineOptions)
{
ALICEVISION_LOG_INFO("BundleAdjustmentCeres::adjust start");

// create problem
ceres::Problem::Options problemOptions;
problemOptions.loss_function_ownership = ceres::DO_NOT_TAKE_OWNERSHIP;
Expand Down Expand Up @@ -922,6 +924,8 @@ bool BundleAdjustmentCeres::adjust(sfmData::SfMData& sfmData, ERefineOptions ref
_statistics.RMSEinitial = std::sqrt(summary.initial_cost / summary.num_residuals);
_statistics.RMSEfinal = std::sqrt(summary.final_cost / summary.num_residuals);

ALICEVISION_LOG_INFO("BundleAdjustmentCeres::adjust end");

return true;
}

Expand Down
21 changes: 20 additions & 1 deletion src/aliceVision/sfm/pipeline/expanding/ExpansionChunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ namespace sfm {

bool ExpansionChunk::process(sfmData::SfMData & sfmData, const track::TracksHandler & tracksHandler, const std::set<IndexT> & viewsChunk)
{
ALICEVISION_LOG_INFO("ExpansionChunk::process start");
ALICEVISION_LOG_INFO("Chunk size : " << viewsChunk.size());

ALICEVISION_LOG_INFO("Chunk items : ");
for (const auto &item: viewsChunk)
{
ALICEVISION_LOG_INFO("- " << item);
}

//For all views which have been required
//Compute the pose given the existing point cloud
if (!_bundleHandler)
{
return false;
}

ALICEVISION_LOG_INFO("Resection start");
#pragma omp parallel for
for (int i = 0; i < viewsChunk.size(); i++)
{
Expand All @@ -46,7 +56,8 @@ bool ExpansionChunk::process(sfmData::SfMData & sfmData, const track::TracksHand

#pragma omp critical
{
addPose(sfmData, viewId, pose);

addPose(sfmData, viewId, pose);
}
}
}
Expand All @@ -62,6 +73,7 @@ bool ExpansionChunk::process(sfmData::SfMData & sfmData, const track::TracksHand
validViewIds.insert(viewId);
}
}
ALICEVISION_LOG_INFO("Updated valid views count in this chunk : " << validViewIds.size());

//Now that all views of the chunks
if (!triangulate(sfmData, tracksHandler, validViewIds))
Expand All @@ -79,11 +91,14 @@ bool ExpansionChunk::process(sfmData::SfMData & sfmData, const track::TracksHand
_historyHandler->saveState(sfmData);
}

ALICEVISION_LOG_INFO("ExpansionChunk::process end");

return true;
}

bool ExpansionChunk::triangulate(sfmData::SfMData & sfmData, const track::TracksHandler & tracksHandler, const std::set<IndexT> & viewIds)
{
ALICEVISION_LOG_INFO("ExpansionChunk::triangulate start");
SfmTriangulation triangulation(_triangulationMinPoints, _maxTriangulationError);

std::set<IndexT> evaluatedTracks;
Expand All @@ -98,6 +113,7 @@ bool ExpansionChunk::triangulate(sfmData::SfMData & sfmData, const track::Tracks
}

auto & landmarks = sfmData.getLandmarks();
ALICEVISION_LOG_INFO("Existing landmarks : " << landmarks.size());

for (const auto & pl : outputLandmarks)
{
Expand Down Expand Up @@ -127,6 +143,9 @@ bool ExpansionChunk::triangulate(sfmData::SfMData & sfmData, const track::Tracks
landmarks.insert(pl);
}

ALICEVISION_LOG_INFO("New landmarks count : " << landmarks.size());
ALICEVISION_LOG_INFO("ExpansionChunk::triangulate end");

return true;
}

Expand Down
4 changes: 4 additions & 0 deletions src/aliceVision/sfm/pipeline/expanding/ExpansionIteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace sfm {

bool ExpansionIteration::process(sfmData::SfMData & sfmData, track::TracksHandler & tracksHandler)
{
ALICEVISION_LOG_INFO("ExpansionIteration::process start");

if (!_chunkHandler)
{
return false;
Expand Down Expand Up @@ -48,6 +50,8 @@ bool ExpansionIteration::process(sfmData::SfMData & sfmData, track::TracksHandle
_historyHandler->endEpoch(sfmData, _policy->getNextViews());
}

ALICEVISION_LOG_INFO("ExpansionIteration::process end");

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ bool ExpansionPolicyLegacy::process(const sfmData::SfMData & sfmData, const trac
_selectedViews.insert(vscoring[0].id);

int maxSetSize = _maxViewsPerGroup;
if (maxSetSize == 0)
{
maxSetSize = std::numeric_limits<int>::max();
}

if (sfmData.getValidViews().size() < _nbFirstUnstableViews)
{
maxSetSize = 1;
Expand Down
12 changes: 12 additions & 0 deletions src/aliceVision/sfm/pipeline/expanding/ExpansionProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace sfm {

bool ExpansionProcess::process(sfmData::SfMData & sfmData, track::TracksHandler & tracksHandler)
{
ALICEVISION_LOG_INFO("ExpansionProcess start");

if (!_iterationHandler)
{
return false;
Expand Down Expand Up @@ -58,14 +60,20 @@ bool ExpansionProcess::process(sfmData::SfMData & sfmData, track::TracksHandler
}
}
}

ALICEVISION_LOG_INFO("ExpansionProcess poses count : " << sfmData.getPoses().size());
}
while (sfmData.getPoses().size() != nbPoses);

ALICEVISION_LOG_INFO("ExpansionProcess end");

return true;
}

bool ExpansionProcess::prepareExisting(sfmData::SfMData & sfmData, const track::TracksHandler & tracksHandler)
{
ALICEVISION_LOG_INFO("ExpansionProcess prepareExisting");

//Prepare existing data
remapExistingLandmarks(sfmData, tracksHandler);

Expand All @@ -90,6 +98,8 @@ bool ExpansionProcess::prepareExisting(sfmData::SfMData & sfmData, const track::

void ExpansionProcess::remapExistingLandmarks(sfmData::SfMData & sfmData, const track::TracksHandler & tracksHandler)
{
ALICEVISION_LOG_INFO("remapExistingLandmarks");

// get unmap landmarks
sfmData::Landmarks landmarks;

Expand Down Expand Up @@ -150,6 +160,8 @@ void ExpansionProcess::remapExistingLandmarks(sfmData::SfMData & sfmData, const
{
ALICEVISION_LOG_INFO("Not all existing landmarks have been remapped");
}

ALICEVISION_LOG_INFO("Landmarks count after remapping : " << sfmData.getLandmarks().size());
}

} // namespace sfm
Expand Down
9 changes: 9 additions & 0 deletions src/aliceVision/sfm/pipeline/expanding/SfmBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace sfm {

bool SfmBundle::process(sfmData::SfMData & sfmData, const track::TracksHandler & tracksHandler, const std::set<IndexT> & viewIds)
{
ALICEVISION_LOG_INFO("SfmBundle::process start");

BundleAdjustmentCeres::CeresOptions options;
BundleAdjustment::ERefineOptions refineOptions;

Expand Down Expand Up @@ -40,6 +42,7 @@ bool SfmBundle::process(sfmData::SfMData & sfmData, const track::TracksHandler &
}
while (cleanup(sfmData));

ALICEVISION_LOG_INFO("SfmBundle::process end");
return true;
}

Expand All @@ -58,6 +61,12 @@ bool SfmBundle::cleanup(sfmData::SfMData & sfmData)

bool somethingChanged = /*somethingErased || */(nbOutliers > _bundleAdjustmentMaxOutlier);

ALICEVISION_LOG_INFO("SfmBundle::cleanup : ");
ALICEVISION_LOG_INFO(" - nbOutliersResidualErr : " << nbOutliersResidualErr);
ALICEVISION_LOG_INFO(" - nbOutliersAngleErr : " << nbOutliersAngleErr);
ALICEVISION_LOG_INFO(" - somethingErased : " << somethingErased);
ALICEVISION_LOG_INFO(" - somethingChanged : " << somethingChanged);

return somethingChanged;
}

Expand Down
7 changes: 7 additions & 0 deletions src/aliceVision/sfm/pipeline/expanding/SfmResection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ bool SfmResection::processView(
double & updatedThreshold
)
{
ALICEVISION_LOG_INFO("SfmResection::processView start " << viewId);

// A. Compute 2D/3D matches
// A1. list tracks ids used by the view
const aliceVision::track::TrackIdSet & viewTracksIds = tracksPerView.at(viewId);
Expand All @@ -50,6 +52,7 @@ bool SfmResection::processView(

if (trackIds.size() < 3)
{

// If less than 3 points, the resection is theorically impossible.
// Let ignore this view.
return false;
Expand Down Expand Up @@ -83,18 +86,22 @@ bool SfmResection::processView(
double errorMax = 0.0;
if (!internalResection(intrinsic, randomNumberGenerator, structure, observations, featureTypes, pose, inliers, errorMax))
{
ALICEVISION_LOG_INFO("SfmResection::processView internalResection failed " << viewId);
return false;
}

//Refine the pose
if (!internalRefinement(structure, observations, inliers, pose, intrinsic))
{
ALICEVISION_LOG_INFO("SfmResection::processView internalRefinemanet failed " << viewId);
return false;
}

updatedThreshold = errorMax;
updatedPose = pose;

ALICEVISION_LOG_INFO("SfmResection::processView end " << viewId);

return true;
}

Expand Down
Loading