Skip to content

Commit

Permalink
Fix dataset parser
Browse files Browse the repository at this point in the history
  • Loading branch information
lauracanalini committed Sep 13, 2021
1 parent e586821 commit 4c1b616
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 2 additions & 5 deletions modules/core/src/cpu_hal_imgproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,6 @@ void SaltOrPepper(const Image& src, Image& dst, double p, bool per_channel, cons
case DataType::type: \
{ \
TypeInfo_t<DataType::type>* tmp_data = reinterpret_cast<TypeInfo_t<DataType::type>*>(tmp.data_); \
OMP_PAR_FOR \
for (int i = 0; i < tmp.datasize_ / tmp.elemsize_; ++i) { \
if (dist(re) == 0) { \
tmp_data[i] = static_cast<TypeInfo_t<DataType::type>>(color()); \
Expand Down Expand Up @@ -2077,9 +2076,9 @@ struct NormalizeChannelsStruct
{
using srctype = typename TypeInfo<SDT>::basetype;
Image tmp(src.dims_, src.elemtype_, src.channels_, src.colortype_, src.spacings_, src.dev_);

for (int c = 0; c < src.channels_.size(); ++c) {
ConstView<SDT> src_v(src, { 0, 0, c }, {src.dims_[0], src.dims_[1], 1});
ConstView<SDT> src_v(src, { 0, 0, c }, { src.dims_[0], src.dims_[1], 1 });
View<SDT> dst_v(tmp, { 0, 0, c }, { src.dims_[0], src.dims_[1], 1 });

auto tmp_it = dst_v.Begin();
Expand All @@ -2102,7 +2101,6 @@ void CpuHal::Normalize(const Image& src, Image& dst, const double& mean, const d

void CpuHal::Normalize(const Image& src, Image& dst, const std::vector<double>& mean, const std::vector<double>& std)
{

if (src.channels_ != "xyc") {
ECVL_ERROR_NOT_IMPLEMENTED_WHAT("CpuHal::Normalize with multiple means and stds require xyc channels\n")
}
Expand All @@ -2111,7 +2109,6 @@ void CpuHal::Normalize(const Image& src, Image& dst, const std::vector<double>&
table(src.elemtype_)(src, dst, mean, std);
}


template <DataType SDT>
struct CenterCropStruct
{
Expand Down
6 changes: 6 additions & 0 deletions modules/dataset/src/dataset_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ void Dataset::Dump(const path& file_path)
else if (s.label_path_ != nullopt) {
os << tab + tab + "label: " << s.label_path_.value().generic_string() << endl;
}
if (s.values_ != nullopt) {
os << tab + tab + "values: [";
for (auto& v : s.values_.value()) {
os << s.values_.value()[0] << "]" << endl;
}
}
}

if (split_.size() > 0) {
Expand Down

0 comments on commit 4c1b616

Please sign in to comment.