Skip to content
Open
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
16 changes: 8 additions & 8 deletions pyslam/io/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,22 +334,22 @@ def getImage(self, frame_id):
return None
image_file = self.listing[self.i]
img = cv2.imread(image_file)
pattern = re.compile(r"\d+")
if self.timestamps is not None:
# read timestamps from timestamps file
self._timestamp = float(self.timestamps[self.i])
if self.i < len(self.timestamps) - 1:
self._next_timestamp = float(self.timestamps[self.i + 1])
else:
self._next_timestamp = self._timestamp + self.Ts

elif pattern.search(image_file.split("/")[-1].split(".")[0]):
# read timestamps from image filename
self._timestamp = float(image_file.split("/")[-1].split(".")[0])
self._next_timestamp = float(self.listing[self.i + 1].split("/")[-1].split(".")[0])
else:
self._timestamp += self.Ts
self._next_timestamp = self._timestamp + self.Ts
img_name = os.path.splitext(os.path.basename(image_file))[0]
if img_name.isdigit():
# read timestamps from image filename
self._timestamp = float(img_name)
self._next_timestamp = float(os.path.splitext(os.path.basename(self.listing[self.i + 1]))[0])
else:
self._timestamp += self.Ts
self._next_timestamp = self._timestamp + self.Ts
if img is None:
raise IOError("error reading file: ", image_file)
# Increment internal counter.
Expand Down
12 changes: 7 additions & 5 deletions pyslam/slam/cpp/utils/descriptor_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ inline float float_descriptor_distance(const cv::Mat &a, const cv::Mat &b) noexc
return std::sqrt(acc);
}

#if defined(__AVX512F__)
#if defined(__AVX512F__) || defined(__AVX2__)
#include <immintrin.h>
#endif
#if defined(__AVX512F__)
static inline float hsum512_ps(__m512 v) noexcept {
// _mm512_reduce_add_ps is available with AVX-512VL/AVX-512DQ on many toolchains,
// but to be safe use a manual reduction:
Expand All @@ -253,8 +255,8 @@ static inline float hsum512_ps(__m512 v) noexcept {
s = _mm_hadd_ps(s, s);
return _mm_cvtss_f32(s);
}
#elif defined(__AVX2__)
#include <immintrin.h>
#endif
#if defined(__AVX2__)
static inline float hsum256_ps(__m256 v) noexcept {
__m128 low = _mm256_castps256_ps128(v);
__m128 high = _mm256_extractf128_ps(v, 1);
Expand All @@ -265,10 +267,10 @@ static inline float hsum256_ps(__m256 v) noexcept {
sums = _mm_add_ss(sums, shuf); // s3+s2+s1+s0
return _mm_cvtss_f32(sums);
}
#elif defined(__ARM_NEON)
#endif
#if defined(__ARM_NEON)
#include <arm_neon.h>
#endif

template <L2Variant variant>
inline float l2_distance_simd(const cv::Mat &a, const cv::Mat &b) noexcept {
if (!is_float_vec(a) || !is_float_vec(b) || a.total() != b.total())
Expand Down