mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-19 05:40:34 +08:00
lazy all_train_cameras
Summary: Avoid calculating all_train_cameras before it is needed, because it is slow in some datasets. Reviewed By: shapovalov Differential Revision: D38037157 fbshipit-source-id: 95461226655cde2626b680661951ab17ebb0ec75
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b2dc520210
commit
3783437d2f
@@ -10,6 +10,7 @@ from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
from itertools import product
|
||||
|
||||
import numpy as np
|
||||
from pytorch3d.implicitron.dataset.data_loader_map_provider import (
|
||||
DoublePoolBatchSampler,
|
||||
)
|
||||
@@ -53,6 +54,7 @@ class MockDataset(DatasetBase):
|
||||
|
||||
class TestSceneBatchSampler(unittest.TestCase):
|
||||
def setUp(self):
|
||||
np.random.seed(42)
|
||||
self.dataset_overfit = MockDataset(1)
|
||||
|
||||
def test_overfit(self):
|
||||
|
||||
@@ -31,7 +31,7 @@ class TestDataJsonIndex(TestCaseMixin, unittest.TestCase):
|
||||
|
||||
data_source = ImplicitronDataSource(**args)
|
||||
|
||||
cameras = data_source.get_all_train_cameras()
|
||||
cameras = data_source.all_train_cameras
|
||||
self.assertIsInstance(cameras, PerspectiveCameras)
|
||||
self.assertEqual(len(cameras), 81)
|
||||
|
||||
|
||||
@@ -152,6 +152,6 @@ class TestDataLlff(TestCaseMixin, unittest.TestCase):
|
||||
self.assertEqual(i.frame_type, ["unseen"])
|
||||
self.assertEqual(i.image_rgb.shape, (1, 3, 800, 800))
|
||||
|
||||
cameras = data_source.get_all_train_cameras()
|
||||
cameras = data_source.all_train_cameras
|
||||
self.assertIsInstance(cameras, PerspectiveCameras)
|
||||
self.assertEqual(len(cameras), 100)
|
||||
|
||||
Reference in New Issue
Block a user