MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
ImageSetBase.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Drawing;
6using MyCaffe.basecode;
7using System.Threading;
8using System.Diagnostics;
10
11namespace MyCaffe.db.image
12{
16 public class ImageSetBase : IDisposable
17 {
26
33 {
34 m_src = new SourceDescriptor(src);
35 m_factory = new DatasetFactory(factory);
36 m_factory.Open(src.ID);
37 }
38
43 protected virtual void Dispose(bool bDisposing)
44 {
45 if (m_factory != null)
46 {
49 m_factory = null;
50 }
51 }
52
56 public void Dispose()
57 {
58 Dispose(true);
59 }
60
65 {
66 get { return m_src; }
67 }
68
74 {
76 }
77
83 public void UpdateLabelMapping(int nNewLabel, List<int> rgOriginalLabels)
84 {
85 m_factory.UpdateLabelMapping(nNewLabel, rgOriginalLabels, m_src.ID);
86 }
87
92 public void ResetLabels(int nProjectId)
93 {
94 m_factory.ResetLabels(nProjectId, m_src.ID);
95 }
96
101 public void DeleteLabelBoosts(int nProjectId)
102 {
103 m_factory.DeleteLabelBoosts(nProjectId, m_src.ID);
104 }
105
112 public void AddLabelBoost(int nProjectId, int nLabel, double dfBoost)
113 {
114 m_factory.AddLabelBoost(nProjectId, nLabel, dfBoost, m_src.ID);
115 }
116
122 public string GetLabelBoostsAsText(int nProjectId)
123 {
124 return m_factory.GetLabelBoostsAsText(nProjectId, m_src.ID);
125 }
126
131 public Dictionary<int, int> LoadLabelCounts()
132 {
134 }
135
140 public void UpdateLabelCounts(int nProjectId)
141 {
142 m_factory.UpdateLabelCounts(m_src.ID, nProjectId);
143 }
144
149 public string GetLabelCountsAsText()
150 {
152 }
153 }
154}
The LabelMapping class represents a single label mapping.
int ID
Get/set the database ID of the item.
The SourceDescriptor class contains all information describing a data source.
The DatasetFactory manages the connection to the Database object.
void AddLabelBoost(int nProjectId, int nLabel, double dfBoost, int nSrcId=0)
Add a label boost to the database for a given project.
void ResetLabels(int nProjectId=0, int nSrcId=0)
Resets all labels back to their original labels for a project.
void UpdateLabelCounts(Dictionary< int, int > rgCounts)
Updates the label counts in the database for the open data source.
string GetLabelCountsAsText(int nSrcId)
Returns the label counts for a given data source.
void UpdateLabelMapping(int nNewLabel, List< int > rgOriginalLabels, int nSrcId=0)
Update a label mapping in the database for a data source.
void Close()
Close the current data source used.
void SetLabelMapping(LabelMapping map, int nSrcId=0)
Saves a label mapping in the database for a data source.
Dictionary< int, int > LoadLabelCounts(int nSrcId=0)
Load the label counts from the database for a data source.
void Dispose()
Releases all resources used.
void DeleteLabelBoosts(int nProjectId, int nSrcId=0)
Delete all label boosts for a project.
string GetLabelBoostsAsText(int nProjectId, int nSrcId=0, bool bSort=true)
Returns the Label boosts as a string.
void Open(SourceDescriptor src, int nCacheMax=500, ConnectInfo ci=null)
Open a given data source.
The ImageSetBase class contains the list of image for a data source as well as a list of LabelSets th...
Definition: ImageSetBase.cs:17
SourceDescriptor Source
Returns the data source of the image set.
Definition: ImageSetBase.cs:65
string GetLabelBoostsAsText(int nProjectId)
Returns the label boosts as text.
DatasetFactory m_factory
Specifies the DatasetFactory used to work with the underlying database.
Definition: ImageSetBase.cs:21
virtual void Dispose(bool bDisposing)
Releases the resouces used.
Definition: ImageSetBase.cs:43
void DeleteLabelBoosts(int nProjectId)
Deletes the label boosts for a project.
string GetLabelCountsAsText()
Returns the label counts for the ImageList as text.
void Dispose()
Releases the resouces used.
Definition: ImageSetBase.cs:56
void ResetLabels(int nProjectId)
Resets the labels for a project.
Definition: ImageSetBase.cs:92
void UpdateLabelCounts(int nProjectId)
Updates the label counts for a project.
ImageSetBase(DatasetFactory factory, SourceDescriptor src)
The ImageSet constructor.
Definition: ImageSetBase.cs:32
Dictionary< int, int > LoadLabelCounts()
Returns the label counts as a dictionary of item pairs (int nLabel, int nCount).
SourceDescriptor m_src
Specifies the data source used with this Image Set.
Definition: ImageSetBase.cs:25
void SetLabelMapping(LabelMapping map)
Set the label mapping of the ImageSet.
Definition: ImageSetBase.cs:73
void UpdateLabelMapping(int nNewLabel, List< int > rgOriginalLabels)
Update the label mapping on the ImageSet.
Definition: ImageSetBase.cs:83
void AddLabelBoost(int nProjectId, int nLabel, double dfBoost)
Adds a label boost for a project.
The descriptors namespace contains all descriptor used to describe various items stored within the da...
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.db.image namespace contains all image database related classes.
Definition: Database.cs:18
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12