version bump

This commit is contained in:
Шурупов Илья Викторович 2025-11-24 12:17:20 +03:00
parent 44bc283f4f
commit 35a2297ab2
6 changed files with 16 additions and 9 deletions

View file

@ -10,6 +10,8 @@
using namespace tp; using namespace tp;
#include <filesystem>
void loadImage(Buffer<halnf>& output, const char* name) { void loadImage(Buffer<halnf>& output, const char* name) {
int x, y, channels_in_file; int x, y, channels_in_file;
unsigned char* loadedImage = stbi_load(name, &x, &y, &channels_in_file, 4); unsigned char* loadedImage = stbi_load(name, &x, &y, &channels_in_file, 4);
@ -28,7 +30,9 @@ void loadImage(Buffer<halnf>& output, const char* name) {
void loadNN(FCNN& nn) { void loadNN(FCNN& nn) {
ArchiverLocalConnection<true> archiver; ArchiverLocalConnection<true> archiver;
archiver.connection.connect(LocalConnection::Location("NumRec.wb"), LocalConnection::Type(true)); if (std::filesystem::exists(std::filesystem::path("NumRec.wb"))) {
archiver.connection.connect(LocalConnection::Location("NumRec.wb"), LocalConnection::Type(true));
}
if (archiver.connection.getConnectionStatus().isOpened()) { if (archiver.connection.getConnectionStatus().isOpened()) {
archiver % nn; archiver % nn;
@ -56,7 +60,7 @@ void executeCmd(const char* imageName) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
const char* imageName = "digit.png"; const char* imageName = "tmp2.png";
if (argc == 2) { if (argc == 2) {
imageName = argv[1]; imageName = argv[1];

View file

@ -1,3 +1,4 @@
#include <filesystem>
#include "FCNN.hpp" #include "FCNN.hpp"
#include "LocalConnection.hpp" #include "LocalConnection.hpp"
@ -71,7 +72,9 @@ struct NumberRec {
{ {
ArchiverLocalConnection<true> archiver; ArchiverLocalConnection<true> archiver;
archiver.connection.connect(LocalConnection::Location("NumRec.wb"), LocalConnection::Type(true)); if (std::filesystem::exists(std::filesystem::path("NumRec.wb"))) {
archiver.connection.connect(LocalConnection::Location("NumRec.wb"), LocalConnection::Type(true));
}
if (archiver.connection.getConnectionStatus().isOpened()) { if (archiver.connection.getConnectionStatus().isOpened()) {
archiver % nn; archiver % nn;
@ -215,7 +218,7 @@ int main() {
auto batchSize = trainRange.idxDiff() / numBatches; auto batchSize = trainRange.idxDiff() / numBatches;
for (auto epoch : IterRange(1)) { for (auto epoch : IterRange(10)) {
printf("Epoch %i\n", epoch.index()); printf("Epoch %i\n", epoch.index());
for (auto batchIdx : IterRange(trainRange.idxDiff() / batchSize)) { for (auto batchIdx : IterRange(trainRange.idxDiff() / batchSize)) {
@ -241,5 +244,5 @@ int main() {
// app.displayImage(i); // app.displayImage(i);
} }
printf("\n\nIncorrect - %i out of %i (%f)\n\n", errors, testRange.idxDiff(), (halnf) errors / (halnf) testRange.idxDiff()); printf("\n\nIncorrect - %i out of %i error percentage (%f)\n\n", errors, testRange.idxDiff(), (halnf) errors / (halnf) testRange.idxDiff());
} }

2
Externals/lalr vendored

@ -1 +1 @@
Subproject commit 6d16a6bb60490a2ee4e86f689c86e647b300c7fb Subproject commit 498612239713a6dbbf9f26b8e412e985538a0650

View file

@ -15,7 +15,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC Graphics Connection Widgets)
target_link_libraries(${PROJECT_NAME} PUBLIC ${BINDINGS_LIBS}) target_link_libraries(${PROJECT_NAME} PUBLIC ${BINDINGS_LIBS})
file(COPY "library" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}") file(COPY "library" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}")
file(COPY "applications/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/") file(COPY "applications/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/rsc/")
### -------------------------- Applications -------------------------- ### ### -------------------------- Applications -------------------------- ###
add_executable(libView ./applications/Entry.cpp) add_executable(libView ./applications/Entry.cpp)

View file

@ -19,4 +19,4 @@ add_executable(Sketch3DApp ./applications/Entry.cpp)
target_link_libraries(Sketch3DApp ${PROJECT_NAME}) target_link_libraries(Sketch3DApp ${PROJECT_NAME})
file(COPY "rsc" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/") file(COPY "rsc" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/")
file(COPY "applications/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/") file(COPY "applications/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/rsc")

View file

@ -14,4 +14,4 @@ add_executable(WidgetsExample examples/Example.cpp)
target_link_libraries(WidgetsExample ${PROJECT_NAME} ${GLEW_LIB}) target_link_libraries(WidgetsExample ${PROJECT_NAME} ${GLEW_LIB})
target_include_directories(WidgetsExample PUBLIC ../Externals/glfw/include ${GLEW_INCLUDE_DIR}) target_include_directories(WidgetsExample PUBLIC ../Externals/glfw/include ${GLEW_INCLUDE_DIR})
file(COPY "examples/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/") file(COPY "examples/Font.ttf" DESTINATION "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/rsc")